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

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


The following commit(s) were added to refs/heads/master by this push:
     new d80b802  Differentiate between error conditions and clean shutdown.
d80b802 is described below

commit d80b802485c031ed7deb754b98432b0bf8f83485
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Mar 5 13:36:50 2020 +0000

    Differentiate between error conditions and clean shutdown.
    
    Allow an async request to complete cleanly if the Connector is paused
    before complete() is called on a Container thread.
---
 java/org/apache/coyote/AbstractProcessorLight.java | 2 +-
 java/org/apache/coyote/ajp/AjpProcessor.java       | 6 +++++-
 java/org/apache/coyote/http11/Http11Processor.java | 4 ++--
 webapps/docs/changelog.xml                         | 4 ++++
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/coyote/AbstractProcessorLight.java 
b/java/org/apache/coyote/AbstractProcessorLight.java
index b26b41f..709530d 100644
--- a/java/org/apache/coyote/AbstractProcessorLight.java
+++ b/java/org/apache/coyote/AbstractProcessorLight.java
@@ -77,7 +77,7 @@ public abstract class AbstractProcessorLight implements 
Processor {
                         "], State out: [" + state + "]");
             }
 
-            if (state != SocketState.CLOSED && isAsync()) {
+            if (isAsync()) {
                 state = asyncPostProcess();
                 if (getLog().isDebugEnabled()) {
                     getLog().debug("Socket: [" + socketWrapper +
diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java 
b/java/org/apache/coyote/ajp/AjpProcessor.java
index f1c5d1f..596dbcf 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -334,7 +334,11 @@ public class AjpProcessor extends AbstractProcessor {
         // Set keep alive timeout for next request
         socketWrapper.setReadTimeout(protocol.getKeepAliveTimeout());
         recycle();
-        return SocketState.OPEN;
+        if (protocol.isPaused()) {
+            return SocketState.CLOSED;
+        } else {
+            return SocketState.OPEN;
+        }
     }
 
 
diff --git a/java/org/apache/coyote/http11/Http11Processor.java 
b/java/org/apache/coyote/http11/Http11Processor.java
index f6d0c6e..4c8172f 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -438,7 +438,7 @@ public class Http11Processor extends AbstractProcessor {
 
         rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
 
-        if (getErrorState().isError() || protocol.isPaused()) {
+        if (getErrorState().isError() || (protocol.isPaused() && !isAsync())) {
             return SocketState.CLOSED;
         } else if (isAsync()) {
             return SocketState.LONG;
@@ -1045,7 +1045,7 @@ public class Http11Processor extends AbstractProcessor {
 
     @Override
     protected SocketState dispatchEndRequest() {
-        if (!keepAlive) {
+        if (!keepAlive || protocol.isPaused()) {
             return SocketState.CLOSED;
         } else {
             endRequest();
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index e214a26..8bcfe05 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -140,6 +140,10 @@
         TLS read stops once the provided ByteBuffers are full or no more data 
is
         available. (markt)
       </fix>
+      <fix>
+        Allow async requests to complete cleanly when the Connector is paused
+        before <code>complete()</code> is called on a container thread. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Cluster">


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

Reply via email to