Author: markt
Date: Tue Jul  8 22:08:26 2014
New Revision: 1608963

URL: http://svn.apache.org/r1608963
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56684
Add a workaround for a bug that should never happen along with some basic debug 
logging.

Modified:
    tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties
    tomcat/trunk/java/org/apache/catalina/core/StandardServer.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties?rev=1608963&r1=1608962&r2=1608963&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties Tue Jul  
8 22:08:26 2014
@@ -163,6 +163,7 @@ standardHost.noContext=No Context config
 standardHost.notContext=Child of a Host must be a Context
 standardHost.nullName=Host name is required
 standardServer.shutdownViaPort=A valid shutdown command was received via the 
shutdown port. Stopping the Server instance.
+standardServer.accept.timeout=The socket listening for the shutdown command 
experienced an unexpected timeout [{0}] milliseconds after the call to 
accept(). Is this an instance of bug 56684?
 standardService.connector.initFailed=Failed to initialize connector [{0}]
 standardService.connector.pauseFailed=Failed to pause connector [{0}]
 standardService.connector.startFailed=Failed to start connector [{0}]

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardServer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardServer.java?rev=1608963&r1=1608962&r2=1608963&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardServer.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardServer.java Tue Jul  8 
22:08:26 2014
@@ -24,6 +24,7 @@ import java.io.InputStream;
 import java.net.InetAddress;
 import java.net.ServerSocket;
 import java.net.Socket;
+import java.net.SocketTimeoutException;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLClassLoader;
@@ -440,10 +441,18 @@ public final class StandardServer extend
                 StringBuilder command = new StringBuilder();
                 try {
                     InputStream stream;
+                    long acceptStartTime = System.currentTimeMillis();
                     try {
+                        serverSocket.setSoTimeout(5000);
                         socket = serverSocket.accept();
                         socket.setSoTimeout(10 * 1000);  // Ten seconds
                         stream = socket.getInputStream();
+                    } catch (SocketTimeoutException ste) {
+                        // This should never happen but bug 56684 suggests that
+                        // it does.
+                        log.warn(sm.getString("standardServer.accept.timeout",
+                                Long.valueOf(System.currentTimeMillis() - 
acceptStartTime)), ste);
+                        continue;
                     } catch (AccessControlException ace) {
                         log.warn("StandardServer.accept security exception: "
                                 + ace.getMessage(), ace);

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1608963&r1=1608962&r2=1608963&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue Jul  8 22:08:26 2014
@@ -107,6 +107,11 @@
         value during a cross-context dispatch. (markt)
       </fix>
       <fix>
+        <bug>56684</bug>: Ensure that Tomcat does not shut down if the socket
+        waiting for the shutdown command experiences a
+        <code>SocketTimeoutException</code>. (markt)
+      </fix>
+      <fix>
         <bug>56693</bug>: Fix various issues in the static resource cache
         implementation where the cache retained a stale entry after the
         successful completion of an operation that always invalidates the cache



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to