Author: markt Date: Thu Mar 29 20:05:51 2012 New Revision: 1307088 URL: http://svn.apache.org/viewvc?rev=1307088&view=rev Log: Fix a hanging test with APR. Connections using HTTP keep-alive were not closed on Endpoint.stop() so a stop() start() sequence meant they were kept open with any data sent being ignored until the connection timed out.
Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/ ------------------------------------------------------------------------------ Merged /tomcat/trunk:r1307084 Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1307088&r1=1307087&r2=1307088&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Thu Mar 29 20:05:51 2012 @@ -925,12 +925,19 @@ public class AprEndpoint extends Abstrac return true; } - private void destroySocket(long socket) - { - if (running && socket != 0) { - // If not running the socket will be destroyed by - // parent pool or acceptor socket. - // In any case disable double free which would cause JVM core. + private void destroySocket(long socket) { + // If not running the socket will be destroyed by + // parent pool or acceptor socket. + // In any case disable double free which would cause JVM core. + destroySocket(socket, running); + } + + private void destroySocket(long socket, boolean doIt) { + // Be VERY careful if you call this method directly. If it is called + // twice for the same socket the JVM will core. Currently this is only + // called from Poller.closePollset() to ensure kept alive connections + // are closed when calling stop() followed by start(). + if (doIt && socket != 0) { Socket.destroy(socket); countDownConnection(); } @@ -1179,7 +1186,7 @@ public class AprEndpoint extends Abstrac if (comet) { processSocket(desc[n*2+1], SocketStatus.STOP); } else { - destroySocket(desc[n*2+1]); + destroySocket(desc[n*2+1], true); } } } Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1307088&r1=1307087&r2=1307088&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Thu Mar 29 20:05:51 2012 @@ -182,6 +182,12 @@ unlikely to impact normal usage but it does fix some unit test issues. (markt) </fix> + <fix> + When using the APR connector ensure that any connections in a keep-alive + state are closed when the connector is stopped rather than when the + connector is destroyed. This is important when stop() followed by + start() is called on the connector. (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