This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 59c53815d0cead640663d6a1fcdef826335e283e
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Apr 19 18:08:09 2024 +0100

    Reduce the default wait time for the acceptor unlock
---
 java/org/apache/tomcat/util/net/NioEndpoint.java | 7 ++++++-
 webapps/docs/changelog.xml                       | 6 ++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java 
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index e949b11df4..30279002dd 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -297,7 +297,12 @@ public class NioEndpoint extends 
AbstractNetworkChannelEndpoint<NioChannel,Socke
         }
         if (running) {
             running = false;
-            acceptor.stopMillis(10000);
+            /*
+             * Need to wait for the acceptor to unlock but not too long. 100ms 
plus twice the unlock timeout should be
+             * plenty of time for the acceptor to unlock without being an 
excessively long wait if the unlock fails.
+             */
+            int acceptorWaitMilliSeconds = 100 + 2 * 
getSocketProperties().getUnlockTimeout();
+            acceptor.stopMillis(acceptorWaitMilliSeconds);
             if (poller != null) {
                 poller.destroy();
                 poller = null;
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 6cc139f23a..c0cf843180 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -153,6 +153,12 @@
         negative or zero value is configured, the default of <code>250ms</code>
         will be used. (mark)
       </fix>
+      <fix>
+        Reduce the time spent waiting for the connector to unlock. The previous
+        default of 10s was noticeably too long for cases where the unlock has
+        failed. The wait time is now 100ms plus twice
+        <code>socket.unlockTimeout</code>. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Other">


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

Reply via email to