Hard close the accepting socket if unlockAccept failed
authormturk <mturk@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 3 Sep 2010 19:54:02 +0000 (19:54 +0000)
committermturk <mturk@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 3 Sep 2010 19:54:02 +0000 (19:54 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@992440 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/net/AprEndpoint.java

index 5508e5d..156be82 100644 (file)
@@ -671,6 +671,7 @@ public class AprEndpoint extends AbstractEndpoint {
             running = false;
             unlockAccept();
             for (int i = 0; i < acceptors.length; i++) {
+                int c = 0;
                 while (acceptors[i].isAlive()) {
                     try {
                         acceptors[i].interrupt();
@@ -678,6 +679,14 @@ public class AprEndpoint extends AbstractEndpoint {
                     } catch (InterruptedException e) {
                         // Ignore
                     }
+                    if (c++ > 60) {
+                        // If the Acceptor is still running force
+                        // the hard socket close.
+                        if (serverSock != 0) {
+                            Socket.close(serverSock);
+                            serverSock = 0;
+                        }
+                    }
                 }
             }
             for (int i = 0; i < pollers.length; i++) {