Author: markt Date: Thu Feb 18 16:46:44 2016 New Revision: 1731093 URL: http://svn.apache.org/viewvc?rev=1731093&view=rev Log: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58646 Correct a problem with sendfile that resulted in a Processor being added to the cache twice leading to broken responses.
Modified: tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1731093&r1=1731092&r2=1731093&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original) +++ tomcat/tc8.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Thu Feb 18 16:46:44 2016 @@ -1197,21 +1197,22 @@ public class NioEndpoint extends Abstrac sd.fchannel.close(); } catch (Exception ignore) { } - if ( sd.keepAlive ) { + // For calls from outside the Poller, the caller is + // responsible for registering the socket for the + // appropriate event(s) if sendfile completes. + if (!calledByProcessor) { + if (sd.keepAlive) { if (log.isDebugEnabled()) { log.debug("Connection is keep alive, registering back for OP_READ"); } - if (calledByProcessor) { - this.add(attachment.getSocket(),SelectionKey.OP_READ); - } else { - reg(sk,attachment,SelectionKey.OP_READ); + reg(sk,attachment,SelectionKey.OP_READ); + } else { + if (log.isDebugEnabled()) { + log.debug("Send file connection is being closed"); } - } else { - if (log.isDebugEnabled()) { - log.debug("Send file connection is being closed"); + cancelledKey(sk,SocketStatus.STOP); + return false; } - cancelledKey(sk,SocketStatus.STOP); - return false; } } else { if (log.isDebugEnabled()) { Modified: tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml?rev=1731093&r1=1731092&r2=1731093&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Thu Feb 18 16:46:44 2016 @@ -90,6 +90,15 @@ </fix> </changelog> </subsection> + <subsection name="Coyote"> + <changelog> + <fix> + <bug>58646</bug>: Correct a problem with sendfile that resulted in a + Processor being added to the cache twice leading to broken responses. + (markt) + </fix> + </changelog> + </subsection> <subsection name="Web applications"> <changelog> <fix> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org