Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: 6.1.6
-
Fix Version/s: None
-
Component/s: HTTP
-
Labels:None
-
Environment:Windows Server 2003, Java 1.6 with Jetty as an embedded HTTP server and NIO sockets enabled.
-
Number of attachments :
Description
I saw this problem reported in an earlier and marked as fixed in an earlier version of Jetty 6.1.x but we just upgraded to 6.1.6 and we continue to receive EofExceptions when binary data is being written to an HTTP response that has been closed prematurely by the client.
20071217 17:04:15,796|L2|org.mortbay.jetty.EofException
at org.mortbay.jetty.HttpGenerator.flush(HttpGenerator.java:760)
at org.mortbay.jetty.AbstractGenerator$Output.blockForOutput(AbstractGenerator.java:548)
at org.mortbay.jetty.AbstractGenerator$Output.flush(AbstractGenerator.java:569)
at org.mortbay.jetty.HttpConnection$Output.flush(HttpConnection.java:905)
at org.mortbay.jetty.AbstractGenerator$Output.write(AbstractGenerator.java:638)
at org.mortbay.jetty.AbstractGenerator$Output.write(AbstractGenerator.java:587)
at com.fived.http.HttpResponse.append(HttpResponse.java:71)
at com.fived.asset.AssetImageHandler.handle(AssetImageHandler.java:89)
at com.fived.http.HttpHandlerAdapter.handle(HttpHandlerAdapter.java:65)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:722)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
The easiest way to recreate the problem is to use Intenet Explorer to request binary data (an image or a zip file, for example) and use a custom Handler to generate said data. Before the data is sent, navigate away from the page and then allow the data to be sent via getOutputStream().write(byte[]) - Jetty throws an EofException while it tries to flush it's buffer. In our use case, we have a webpage with a dozen images on it that are retrieved from a database. The transaction for any given image is very fast - very little overhead - but there are a surprising number of this exception in our logs. People are clearly not waiting for all of the images to load before they move on to another page in our system.
We've resorted to ignoring this particular exception in the one instance where we're writing binary data to the HTTP response, but I feel like that's the wrong solution. I've hunted around but it doesn't appear that I can detect that the connection has been closed before or while I am sending bytes to the OutputStream.
We appreciate any assistance. Thanks.
I am NOT able to reproduce the problem in Firefox, however. I can only presume that it keeps the connections open when you navigate away ... ? ... although that doesn't sound right either.