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=40960>. 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=40960 Summary: APR versus non-APR behavior difference: Timeout when reading from underlying socket does throw IOException with APR and SocketTimeoutException without APR Product: Tomcat 5 Version: 5.5.20 Platform: PC OS/Version: Windows 2000 Status: NEW Severity: normal Priority: P2 Component: Connector:HTTP AssignedTo: tomcat-dev@jakarta.apache.org ReportedBy: [EMAIL PROTECTED] Timeout when reading from underlying socket does throw IOException with APR and SocketTimeoutException without APR. This difference causes servlet code handling "timeout exceptions" to break (and not be fixeable) if APR is used. In class "org.apache.coyote.http11.InternalAprInputBuffer" for method "boolean fill() throws IOException": (in block if (!parsingHeader) ) The return code for Socket.recvbb is not checked for Status.ETIMEDOUT or Status.TIMEUP, therefore an IOException is thrown whatever the reason for the exception. This is a behavior change from non-APR HTTP 1.1 connector. The following new code for the fill method fixes the issue: /** * Fill the internal buffer using data from the undelying input stream. * * @return false if at end of stream */ protected boolean fill() throws IOException { int nRead = 0; if (parsingHeader) { if (lastValid == buf.length) { throw new IOException (sm.getString("iib.requestheadertoolarge.error")); } bbuf.clear(); nRead = Socket.recvbb (socket, 0, buf.length - lastValid); if (nRead > 0) { bbuf.limit(nRead); bbuf.get(buf, pos, nRead); lastValid = pos + nRead; } else { if ((-nRead) == Status.EAGAIN) { return false; } else { throw new IOException(sm.getString("iib.failedread")); } } } else { buf = bodyBuffer; pos = 0; lastValid = 0; bbuf.clear(); nRead = Socket.recvbb (socket, 0, buf.length); if (nRead > 0) { bbuf.limit(nRead); bbuf.get(buf, 0, nRead); lastValid = nRead; } else { // CP: Start change if ((-nRead) == Status.ETIMEDOUT || (-nRead) == Status.TIMEUP) { throw new java.net.SocketTimeoutException(sm.getString("iib.failedread")); } else { throw new IOException(sm.getString("iib.failedread")); } // CP: End change } } return (nRead > 0); } Since SocketTimeOutException is also an IOException, this modification cannot break code that does not filter timeout exceptions. -- 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]