DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41772>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41772


[EMAIL PROTECTED] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
            Summary|Brand new                   |HttpServletResponse is
                   |HttpServletResponse is      |already committed.
                   |already committed.          |




------- Additional Comments From [EMAIL PROTECTED]  2007-03-06 12:43 -------
So, sheepishly I admit that this is an application error, but I believe there's
still a weakness to be patched up.  

It relates back to the Java2D stuff I'm using.  After the following two lines:

ImageOutputStream 
out=ImageIO.createImageOutputStream(response.getOutputStream());
ImageIO.write(image,"png",out);
response.getOutputStream().flush();

I never closed ImageOutputStream.  Obviously an application error.  However, in
the catalina logs, I found this stack trace:

2007-03-05 07:00:01,167 [Finalizer] ERROR org.apache.jk.server.JkCoyoteHandler -
Error in action code
java.net.SocketException: Socket closed
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:99)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
        at org.apache.jk.common.ChannelSocket.send(ChannelSocket.java:506)
        at 
org.apache.jk.server.JkCoyoteHandler.appendHead(JkCoyoteHandler.java:401)
        at org.apache.jk.server.JkCoyoteHandler.action(JkCoyoteHandler.java:416)
        at org.apache.coyote.Response.action(Response.java:182)
        at org.apache.coyote.Response.sendHeaders(Response.java:374)
        at org.apache.coyote.tomcat5.OutputBuffer.doFlush(OutputBuffer.java:322)
        at org.apache.coyote.tomcat5.OutputBuffer.flush(OutputBuffer.java:298)
        at
org.apache.coyote.tomcat5.CoyoteOutputStream.flush(CoyoteOutputStream.java:85)
        at
javax.imageio.stream.FileCacheImageOutputStream.close(FileCacheImageOutputStream.java:194)
        at
javax.imageio.stream.ImageInputStreamImpl.finalize(ImageInputStreamImpl.java:850)
        at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
        at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
        at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)


During GC, that ImageOutputStream is trying to flush the response output stream.
 It seems like Tomcat recycles HttpServletResponse objects.  If this finalizer
is executed AFTER the Response object it references is recycled, the resulting
'flush()' would cause that Response object to become committed.  When a new
request then comes in to be handled by a thread with a now broken Response
object . . . well, there's where my error comes from.

I also believe this bug report relates directly to bug #37516.  Note that in the
example code provided in that bug, he ALSO does not close his image output
stream.  My apologies for duplicating a previous bug.

While I understand this is my application's bug, it seems that recycling
Response objects should be a bit more safe than it currently is.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to