Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 7.0.0.pre5
-
Fix Version/s: 6.1.15.pre0
-
Component/s: Continuations
-
Labels:None
-
Environment:Linux 64-bit, OpenJDK 6, .., but doesn't seem relevant
-
Number of attachments :
Description
It seems that if a request is suspended (and later resumed), and it includes some POST data which doesn't get automatically processed (like multipart/form-data), it goes into an infinite loop of trying to handle that request over and over. If the POST data is read in full from the InputStream, or the request is not suspended/resumed, the looping doesn't happen. Below is a minimal test case that reproduces the behavior (just open localhost:8083 in a browser and try to upload a file).
—
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.mortbay.jetty.Request;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.handler.AbstractHandler;
import org.mortbay.log.Log;
class SillyHandler extends AbstractHandler {
public void handle(String target, final HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException {
if (request.isInitial()) {
request.suspend();
new Thread() {
public void run() {
try
catch (Exception e)
{ // ignore } request.resume();
}
}.start();
} else
}
}
public class InfiniteLoop {
public static void main(String[] args) throws Exception
}
Here's the beginning of debug output, for your convenience. Two requests were made, the first to display the form, and the second one repeats forever..
2009-01-15 14:02:19.558::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
2009-01-15 14:02:19.582::DEBUG: Container
org.mortbay.jetty.Server@1a0f73c1 +
SelectChannelConnector@0.0.0.0:8083 as connector
2009-01-15 14:02:19.583::DEBUG: Container
org.mortbay.jetty.Server@1a0f73c1 + SillyHandler@5f893efe as handler
2009-01-15 14:02:19.583::INFO: jetty-7.0.0.pre5
2009-01-15 14:02:19.594::DEBUG: Container
org.mortbay.jetty.Server@1a0f73c1 +
org.mortbay.thread.QueuedThreadPool@f7e6a96 as threadpool
2009-01-15 14:02:19.595::DEBUG: started
org.mortbay.thread.QueuedThreadPool@f7e6a96
2009-01-15 14:02:19.595::DEBUG: starting SillyHandler@5f893efe
2009-01-15 14:02:19.595::DEBUG: started SillyHandler@5f893efe
2009-01-15 14:02:19.595::DEBUG: starting org.mortbay.jetty.Server@1a0f73c1
2009-01-15 14:02:19.604::DEBUG: started
org.mortbay.jetty.nio.SelectChannelConnector$1@42b988a6
2009-01-15 14:02:19.610::INFO: Started SelectChannelConnector@0.0.0.0:8083
2009-01-15 14:02:19.610::DEBUG: started SelectChannelConnector@0.0.0.0:8083
2009-01-15 14:02:19.611::DEBUG: started org.mortbay.jetty.Server@1a0f73c1
2009-01-15 14:02:22.753::DEBUG: REQUEST / on
org.mortbay.jetty.nio.SelectChannelConnector$3@67d225a7
2009-01-15 14:02:22.754::DEBUG: RESPONSE / 200
2009-01-15 14:02:22.754::DEBUG: return with suspended request
2009-01-15 14:02:22.854::DEBUG: resume request
2009-01-15 14:02:22.855::DEBUG: REQUEST / on
org.mortbay.jetty.nio.SelectChannelConnector$3@67d225a7
2009-01-15 14:02:22.856::DEBUG: RESPONSE / 200
2009-01-15 14:02:23.864::DEBUG: resume request
2009-01-15 14:02:23.864::DEBUG: REQUEST / on
org.mortbay.jetty.nio.SelectChannelConnector$3@67d225a7
2009-01-15 14:02:23.864::DEBUG: RESPONSE / 200
2009-01-15 14:02:23.864::DEBUG: return with suspended request
2009-01-15 14:02:23.964::DEBUG: resume request
2009-01-15 14:02:23.964::DEBUG: REQUEST / on
org.mortbay.jetty.nio.SelectChannelConnector$3@67d225a7
2009-01-15 14:02:23.964::DEBUG: Ignoring extra content <form
method=post enctype="multipart/form-data"><input type=file
name=file><br><input type=submit value=Send></form>
2009-01-15 14:02:23.964::DEBUG: RESPONSE / 200
2009-01-15 14:02:23.965::DEBUG: resume request
2009-01-15 14:02:23.965::DEBUG: REQUEST / on
org.mortbay.jetty.nio.SelectChannelConnector$3@67d225a7
2009-01-15 14:02:23.965::DEBUG: RESPONSE / 200
2009-01-15 14:02:23.965::DEBUG: return with suspended request
2009-01-15 14:02:23.065::DEBUG: resume request
2009-01-15 14:02:23.065::DEBUG: REQUEST / on
org.mortbay.jetty.nio.SelectChannelConnector$3@67d225a7
2009-01-15 14:02:23.065::DEBUG: Ignoring extra content <form
method=post enctype="multipart/form-data"><input type=file
name=file><br><input type=submit value=Send></form>
2009-01-15 14:02:23.065::DEBUG: RESPONSE / 200
2009-01-15 14:02:23.069::DEBUG: resume request
2009-01-15 14:02:23.069::DEBUG: REQUEST / on
org.mortbay.jetty.nio.SelectChannelConnector$3@67d225a7
2009-01-15 14:02:23.069::DEBUG: RESPONSE / 200
2009-01-15 14:02:23.069::DEBUG: return with suspended request
2009-01-15 14:02:23.073::DEBUG: resume request
2009-01-15 14:02:23.074::DEBUG: REQUEST / on
org.mortbay.jetty.nio.SelectChannelConnector$3@67d225a7
etc. etc.
Activity
| Field | Original Value | New Value |
|---|---|---|
| Assignee | David Yu [ dyu ] |
| Attachment | JETTY-860.patch [ 39415 ] |
| Assignee | David Yu [ dyu ] | Greg Wilkins [ gregw ] |
| Attachment |
|
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Fix Version/s | 6.1.15.pre0 [ 14730 ] | |
| Fix Version/s | 7.0.0.pre6 [ 14687 ] | |
| Resolution | Fixed [ 1 ] |
| Fix Version/s | 7.0.0.pre6 [ 14687 ] |
David,
can you look at this issue