This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 15d7c946aa61263797b33adf6395f6bbb9316482 Author: Mark Thomas <ma...@apache.org> AuthorDate: Mon Jan 10 17:22:28 2022 +0000 Refactor Connector/Endpoint pause only stop new connections/requests --- java/org/apache/coyote/AbstractProtocol.java | 6 +----- java/org/apache/tomcat/util/net/AprEndpoint.java | 10 +--------- java/org/apache/tomcat/util/net/Nio2Endpoint.java | 4 ++-- java/org/apache/tomcat/util/net/NioEndpoint.java | 6 +++--- webapps/docs/changelog.xml | 5 +++++ 5 files changed, 12 insertions(+), 19 deletions(-) diff --git a/java/org/apache/coyote/AbstractProtocol.java b/java/org/apache/coyote/AbstractProtocol.java index ab91b37..b1d9659 100644 --- a/java/org/apache/coyote/AbstractProtocol.java +++ b/java/org/apache/coyote/AbstractProtocol.java @@ -591,9 +591,7 @@ public abstract class AbstractProtocol<S> implements ProtocolHandler, endpoint.start(); monitorFuture = getUtilityExecutor().scheduleWithFixedDelay( () -> { - if (!isPaused()) { - startAsyncTimeout(); - } + startAsyncTimeout(); }, 0, 60, TimeUnit.SECONDS); } @@ -636,7 +634,6 @@ public abstract class AbstractProtocol<S> implements ProtocolHandler, getLog().info(sm.getString("abstractProtocolHandler.pause", getName())); } - stopAsyncTimeout(); endpoint.pause(); } @@ -653,7 +650,6 @@ public abstract class AbstractProtocol<S> implements ProtocolHandler, } endpoint.resume(); - startAsyncTimeout(); } diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java index e0deb55..ef6dcdf 100644 --- a/java/org/apache/tomcat/util/net/AprEndpoint.java +++ b/java/org/apache/tomcat/util/net/AprEndpoint.java @@ -1899,14 +1899,6 @@ public class AprEndpoint extends AbstractEndpoint<Long,Long> implements SNICallB // Loop until we receive a shutdown command while (sendfileRunning) { - // Loop if endpoint is paused - while (sendfileRunning && paused) { - try { - Thread.sleep(pollTime / 1000); - } catch (InterruptedException e) { - // Ignore - } - } // Loop if poller is empty while (sendfileRunning && sendfileCount < 1 && addS.size() < 1) { // Reset maintain time. @@ -2146,7 +2138,7 @@ public class AprEndpoint extends AbstractEndpoint<Long,Long> implements SNICallB socketWrapper = null; event = null; //return to cache - if (running && !paused && processorCache != null) { + if (running && processorCache != null) { processorCache.push(this); } } diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java b/java/org/apache/tomcat/util/net/Nio2Endpoint.java index c46a3c4..8388c50 100644 --- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java +++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java @@ -932,7 +932,7 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel,AsynchronousS if (getSocket().isOpen()) { getSocket().close(true); } - if (getEndpoint().running && !getEndpoint().paused) { + if (getEndpoint().running) { if (nioChannels == null || !nioChannels.push(getSocket())) { getSocket().free(); } @@ -1671,7 +1671,7 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel,AsynchronousS socketWrapper = null; event = null; //return to cache - if (running && !paused && processorCache != null) { + if (running && processorCache != null) { processorCache.push(this); } } diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index 123aa49..4e6986c 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -691,7 +691,7 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel> } } } - if (running && !paused && eventCache != null) { + if (running && eventCache != null) { pe.reset(); eventCache.push(pe); } @@ -1218,7 +1218,7 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel> if (getSocket().isOpen()) { getSocket().close(true); } - if (getEndpoint().running && !getEndpoint().paused) { + if (getEndpoint().running) { if (nioChannels == null || !nioChannels.push(getSocket())) { getSocket().free(); } @@ -1726,7 +1726,7 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel> socketWrapper = null; event = null; //return to cache - if (running && !paused && processorCache != null) { + if (running && processorCache != null) { processorCache.push(this); } } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index b33d302..14b11a1 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -158,6 +158,11 @@ <bug>65785</bug>: Perform additional validation of HTTP headers when using HTTP/2. (markt) </fix> + <fix> + When a Connector or Endpoint is paused, ensure that only new connections + and new requests on existing connections are stopped while allowing in + progress requests to run to completion. (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