Author: markt Date: Thu Sep 17 08:20:16 2015 New Revision: 1703516 URL: http://svn.apache.org/r1703516 Log: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58388 Fix a data race when determining if Comet processing is occurring on a container or non-container thread.
Modified: tomcat/tc8.0.x/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc8.0.x/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java?rev=1703516&r1=1703515&r2=1703516&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java (original) +++ tomcat/tc8.0.x/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java Thu Sep 17 08:20:16 2015 @@ -25,6 +25,7 @@ import java.util.Set; import javax.net.ssl.SSLEngine; import org.apache.coyote.ActionCode; +import org.apache.coyote.ContainerThreadMarker; import org.apache.coyote.ErrorState; import org.apache.coyote.RequestInfo; import org.apache.coyote.http11.filters.BufferedInputFilter; @@ -516,8 +517,7 @@ public class Http11Nio2Processor extends if (socketWrapper == null || socketWrapper.getSocket() == null) { return; } - RequestInfo rp = request.getRequestProcessor(); - if (rp.getStage() != org.apache.coyote.Constants.STAGE_SERVICE) { + if (!ContainerThreadMarker.isContainerThread()) { // Close event for this processor triggered by request // processing in another processor, a non-Tomcat thread (i.e. // an application controlled thread) or similar. @@ -532,10 +532,9 @@ public class Http11Nio2Processor extends if (socketWrapper == null) { return; } - long timeout = ((Long)param).longValue(); - //if we are not piggy backing on a worker thread, set the timeout - RequestInfo rp = request.getRequestProcessor(); - if ( rp.getStage() != org.apache.coyote.Constants.STAGE_SERVICE ) { + // If we are not piggy backing on a worker thread, set the timeout + if (!ContainerThreadMarker.isContainerThread()) { + long timeout = ((Long)param).longValue(); socketWrapper.setTimeout(timeout); } break; 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=1703516&r1=1703515&r2=1703516&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Thu Sep 17 08:20:16 2015 @@ -156,6 +156,10 @@ <bug>58387</bug>: Fix a rare data race when closing Comet connections. (markt) </fix> + <fix> + <bug>58388</bug>: Fix a data race when determining if Comet processing + is occurring on a container or non-container thread. (markt) + </fix> </changelog> </subsection> <subsection name="Jasper"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org