https://issues.apache.org/bugzilla/show_bug.cgi?id=51324

             Bug #: 51324
           Summary: When OutputBuffer.doFlush gets Exception, doFlush gets
                    stuck to true
           Product: Tomcat 7
           Version: 7.0.14
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Connectors
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: bow.rugg...@service-now.com
    Classification: Unclassified


Created attachment 27114
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27114
The line that causes doFlush to be stuck at true if it gets an exception

First time opening a bug, please forgive me if this report isn't perfect!

I recently ran into an issue where OutputBuffer's doFlush gets stuck to true.

In OutputBuffer.doFlush(boolean) it sets doFlush = true, then calls
bb.flushBuffer, then sets doFlush = false.

I issue I ran into was bb.flushBuffer eventually calls
OutputBuffer.realWriteBytes.  The realWriteBytes eventually calls
coyoteResponse.doWrite.  If coyoteResponse.doWrite throws an IOException, then
it rethrows a ClientAbortException.

What I am seeing is my client disconnecting early, and causing the doWrite to
throw a SocketException of "Broken pipe".  That broken pipe causes a
ClientAbortException to be thrown. 

When that is thrown, the error is bubbled up and doFlush is stuck as "true". 
The next time the processor is used, it calls the recycle() method in
OutputBuffer. However, the recycle doesn't reset doFlush so its still set to
true.

I imagine there are quite a few ways to fix this, but the two obvious ones that
come to mind are:

- Have recycle() set doFlush back to false

or 

- Have throw a finally in try/catch/finally in OutputBuffer.doFlush so doFlush
is set back to false when an Exception is catch

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to