Author: rjung Date: Mon Jun 13 18:14:46 2011 New Revision: 1135208 URL: http://svn.apache.org/viewvc?rev=1135208&view=rev Log: Fix crash observed during pausing the connector when using APR.
Only add socket to poller if we are sure we don't close it later. Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java?rev=1135208&r1=1135207&r2=1135208&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Mon Jun 13 18:14:46 2011 @@ -319,13 +319,6 @@ public class AjpAprProcessor extends Abs recycle(); } - // Add the socket to the poller - if (!error && !endpoint.isPaused()) { - if (!isAsync()) { - ((AprEndpoint)endpoint).getPoller().add(socketRef); - } - } - rp.setStage(org.apache.coyote.Constants.STAGE_ENDED); if (error || endpoint.isPaused()) { @@ -333,6 +326,8 @@ public class AjpAprProcessor extends Abs } else if (isAsync()) { return SocketState.LONG; } else { + // Add the socket to the poller + ((AprEndpoint)endpoint).getPoller().add(socketRef); return SocketState.OPEN; } } Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java?rev=1135208&r1=1135207&r2=1135208&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java Mon Jun 13 18:14:46 2011 @@ -212,6 +212,7 @@ public class Http11AprProcessor extends boolean keptAlive = false; boolean openSocket = false; + boolean addToPoller = false; while (!error && keepAlive && !comet && !isAsync() && !endpoint.isPaused()) { @@ -225,14 +226,13 @@ public class Http11AprProcessor extends // (long keepalive), so that the processor should be recycled // and the method should return true openSocket = true; - // Add the socket to the poller - ((AprEndpoint)endpoint).getPoller().add(socketRef); if (endpoint.isPaused()) { // 503 - Service unavailable response.setStatus(503); adapter.log(request, response, 0); error = true; } else { + addToPoller = true; break; } } @@ -350,6 +350,10 @@ public class Http11AprProcessor extends } else if (comet || isAsync()) { return SocketState.LONG; } else { + // Add the socket to the poller + if (addToPoller) { + ((AprEndpoint)endpoint).getPoller().add(socketRef); + } return (openSocket) ? SocketState.OPEN : SocketState.CLOSED; } Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1135208&r1=1135207&r2=1135208&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Mon Jun 13 18:14:46 2011 @@ -57,6 +57,11 @@ Remove superfluous quotes from thread names for connection pools. (rjung) </fix> + <fix> + Fix crash observed during pausing the connector when using APR. + Only add socket to poller if we are sure we don't close it later. + (rjung) + </fix> </changelog> </subsection> <subsection name="Cluster"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org