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

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18233

CoyoteOuputStream throws exception when closing

           Summary: CoyoteOuputStream throws exception when closing
           Product: Tomcat 4
           Version: 4.1.18
          Platform: All
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Connector:Coyote HTTP/1.1
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Whilst printing a String to the ServletOuputStream, if the user presses 
the 'stop' button on their browser then an IOException is thrown.  It is 
standard practice to try and close resources when an error occurs but when I 
try to close the stream I get another IOException (Connection reset by peer) 
because the close() method is trying to flush the stream.

Now, either it is standard practice to not call close() or to ignore the 
exception but either of these means that the client is not confident that all 
the resources around the stream were cleaned up.  I consider this a usability 
bug and possibly a functional bug, I don't really have time to investigate in 
the code any further to see whether the stream not being cleaned up causes any 
problems.

Below is the stack trace that is thrown when trying to call close() on the 
ServletOuputStream using Tomcat 4.1.18, Java 1.4.1_02 under Windows 2K SP3:

  java.net.SocketException: Connection reset by peer: socket write error
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
        at 
org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite
(InternalOutputBuffer.java:668)

        at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite
(ChunkedOutputFilter.java:166)
        at org.apache.coyote.http11.InternalOutputBuffer.doWrite
(InternalOutputBuffer.java:523)
        at org.apache.coyote.Response.doWrite(Response.java:524)
        at org.apache.coyote.tomcat4.OutputBuffer.realWriteBytes
(OutputBuffer.java:384)
        at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:360)
        at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:338)
        at org.apache.tomcat.util.buf.IntermediateOutputStream.write
(C2BConverter.java:273)
        at sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:334)
        at sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer
(StreamEncoder.java:402)
        at sun.nio.cs.StreamEncoder$CharsetSE.implFlush(StreamEncoder.java:406)
        at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:150)
        at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:213)
        at org.apache.tomcat.util.buf.WriteConvertor.flush
(C2BConverter.java:222)
        at org.apache.tomcat.util.buf.C2BConverter.flushBuffer
(C2BConverter.java:165)
        at org.apache.coyote.tomcat4.OutputBuffer.realWriteChars
(OutputBuffer.java:580)
        at org.apache.tomcat.util.buf.CharChunk.flushBuffer(CharChunk.java:388)
        at org.apache.coyote.tomcat4.OutputBuffer.close(OutputBuffer.java:313)
        at org.apache.coyote.tomcat4.CoyoteOutputStream.close
(CoyoteOutputStream.java:125)

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

Reply via email to