(tomcat) 04/04: Reduce the default wait time for the acceptor unlock

2024-04-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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

commit 725467428b4cfe14b325168bf9849f3d5fe4ae9d
Author: Mark Thomas 
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 434ce6d889..99966fd464 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -323,7 +323,12 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 }
 if (running) {
 running = false;
-acceptor.stopMillis(1);
+/*
+ * 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 c3f8e97f95..3d11e31374 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -148,6 +148,12 @@
 negative or zero value is configured, the default of 250ms
 will be used. (mark)
   
+  
+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
+socket.unlockTimeout. (markt)
+  
 
   
   


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



(tomcat) 04/04: Reduce the default wait time for the acceptor unlock

2024-04-19 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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

commit b76216af5d8ad0608c3da5f0a9a273f3b46f647e
Author: Mark Thomas 
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 c53164e256..9f646e73eb 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -296,7 +296,12 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 }
 if (running) {
 running = false;
-acceptor.stopMillis(1);
+/*
+ * 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 53ebb4a103..c2a903f944 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -158,6 +158,12 @@
 negative or zero value is configured, the default of 250ms
 will be used. (mark)
   
+  
+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
+socket.unlockTimeout. (markt)
+  
 
   
   


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