Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2BDAE200C89 for ; Sat, 3 Jun 2017 19:20:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 2A497160BCD; Sat, 3 Jun 2017 17:20:14 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 49932160BB5 for ; Sat, 3 Jun 2017 19:20:13 +0200 (CEST) Received: (qmail 35707 invoked by uid 500); 3 Jun 2017 17:20:07 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 35694 invoked by uid 99); 3 Jun 2017 17:20:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Jun 2017 17:20:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 07001C12C0 for ; Sat, 3 Jun 2017 17:20:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.502 X-Spam-Level: X-Spam-Status: No, score=-99.502 tagged_above=-999 required=6.31 tests=[KAM_NUMSUBJECT=0.5, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id ejevxYtZkSEa for ; Sat, 3 Jun 2017 17:20:05 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 3CB435FBA4 for ; Sat, 3 Jun 2017 17:20:05 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id B4253E0D4D for ; Sat, 3 Jun 2017 17:20:04 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 745EE21B58 for ; Sat, 3 Jun 2017 17:20:04 +0000 (UTC) Date: Sat, 3 Jun 2017 17:20:04 +0000 (UTC) From: "Rob Tompkins (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Closed] (FILEUPLOAD-136) FileUpload race condition with used with Jetty 6 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sat, 03 Jun 2017 17:20:14 -0000 [ https://issues.apache.org/jira/browse/FILEUPLOAD-136?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Rob Tompkins closed FILEUPLOAD-136. ----------------------------------- > FileUpload race condition with used with Jetty 6 > ------------------------------------------------ > > Key: FILEUPLOAD-136 > URL: https://issues.apache.org/jira/browse/FILEUPLOAD-136 > Project: Commons FileUpload > Issue Type: Bug > Affects Versions: 1.2 > Environment: Running on Windows XP SP2 with Jetty 6 embedded and Firefox 2.0.0.4 > Reporter: Keith Kowalczykowski > Assignee: Jochen Wiedmann > Priority: Critical > Attachments: FileUploadTest.zip, TestJetty.java > > > When running commons file upload with Jetty 6, ServletFileUpload.parseRequest spins and never returns when the user clicks the "stop" button in their browser while an upload is in progress. > Reproduction Steps: > * Create a simple servlet / html form which accepts a file upload using commons file upload (or use the example code below). > * Upload a sufficiently large file that you have time to click the stop button before the upload completes. > * Observe that the thread is now stuck within file upload. > Other Information: > Using jstack, I was able to get the following trace of where it is blocking. It looks like it is on a read() call that file upload is making. > at org/mortbay/jetty/HttpParser$Input.blockForContent(HttpParser.java:922) > at org/mortbay/jetty/HttpParser$Input.read(HttpParser.java:897) > at org/apache/commons/fileupload/MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:959) > at org/apache/commons/fileupload/MultipartStream$ItemInputStream.close(MultipartStream.java:910) > at org/apache/commons/fileupload/util/Streams.copy(Streams.java:119) > at org/apache/commons/fileupload/util/Streams.copy(Streams.java:64) > at org/apache/commons/fileupload/FileUploadBase.parseRequest(FileUploadBase.java:354) > at org/apache/commons/fileupload/servlet/ServletFileUpload.parseRequest(ServletFileUpload.java:126) > at test/Main$1.handle(Main.java:43) > at org/mortbay/jetty/handler/HandlerWrapper.handle(HandlerWrapper.java:139) > at org/mortbay/jetty/Server.handle(Server.java:285) > at org/mortbay/jetty/HttpConnection.handleRequest(HttpConnection.java:502) > at org/mortbay/jetty/HttpConnection$RequestHandler.content(HttpConnection.java:835) > at org/mortbay/jetty/HttpParser.parseNext(HttpParser.java:641) > at org/mortbay/jetty/HttpParser.parseAvailable(HttpParser.java:208) > at org/mortbay/jetty/HttpConnection.handle(HttpConnection.java:378) > at org/mortbay/jetty/bio/SocketConnector$Connection.run(SocketConnector.java:226) > at org/mortbay/thread/BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442) > at jrockit/vm/RNI.c2java(IIII)V(Native Method) > -- end of trac > Originally I thought this was an issue with our code, however, I have since isolated it to a simple test case. Bellow is a class file called Main which when run will instantiate an instance of Jetty on port 8080 and an HTML document that will post a file upload to the servlet. When the stop button is pressed, you will see that the line "Starting processing" is printed, but neither the "Exception occured in processing" or "Processing completed" are printed. I have a full eclipse project (jars and all) on my machine that I was planning on uploading with this ticket, however, I don't see a way to attach a file. Therefore, I have copied and pasted the two files bellow. Let me know if you want the full project. > === Main.java === > /** > * > */ > package test; > import java.io.IOException; > import java.util.List; > import javax.servlet.ServletException; > import javax.servlet.http.HttpServletRequest; > import javax.servlet.http.HttpServletResponse; > import org.apache.commons.fileupload.FileItem; > import org.apache.commons.fileupload.disk.DiskFileItemFactory; > import org.apache.commons.fileupload.servlet.ServletFileUpload; > import org.mortbay.jetty.Handler; > import org.mortbay.jetty.Server; > import org.mortbay.jetty.handler.AbstractHandler; > /** > * @author Keith Kowalczykowski > * > */ > public class Main { > public static void main(String[] args) { > Handler handler = new AbstractHandler() { > public void handle(String arg0, HttpServletRequest arg1, > HttpServletResponse arg2, int arg3) throws IOException, > ServletException > { > System.out.println("Starting processing"); > try > { > // Create a factory for disk-based file items > DiskFileItemFactory factory = new DiskFileItemFactory(); > > // Create a new file upload handler > ServletFileUpload upload = new ServletFileUpload(factory); > > // Parse the request > List items = upload.parseRequest(arg1); > for (int i = 0; i < items.size(); i++) > { > FileItem file_item = (FileItem) items.get(i); > > System.out.println("Field Name: " + file_item.getFieldName()); > } > } > catch (Exception e) > { > e.printStackTrace(); > System.out.println("Exception occured in processing"); > } > finally > { > System.out.println("Processing completed"); > } > } > }; > try > { > Server server = new Server(8080); > server.setHandler(handler); > server.start(); > } > catch (Exception e) > { > > } > } > } > === HTML Document === > > > > >
> > >
> > -- This message was sent by Atlassian JIRA (v6.3.15#6346)