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


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 015c4d5079 Make asynchronous error handling more robust.
015c4d5079 is described below

commit 015c4d50797731e45c1b7216fc09646891c725c4
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Jan 24 14:55:06 2024 +0000

    Make asynchronous error handling more robust.
    
    Ensure that once a connection is marked to be closed, further
    asynchronous processing cannot change that.
---
 java/org/apache/coyote/AbstractProcessorLight.java | 7 ++++++-
 webapps/docs/changelog.xml                         | 5 +++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/coyote/AbstractProcessorLight.java 
b/java/org/apache/coyote/AbstractProcessorLight.java
index 21515c70d7..fdd0d194fe 100644
--- a/java/org/apache/coyote/AbstractProcessorLight.java
+++ b/java/org/apache/coyote/AbstractProcessorLight.java
@@ -74,7 +74,12 @@ public abstract class AbstractProcessorLight implements 
Processor {
                         "Socket: [" + socketWrapper + "], Status in: [" + 
status + "], State out: [" + state + "]");
             }
 
-            if (isAsync()) {
+            /*
+             * If state is already CLOSED don't call asyncPostProcess() as 
that will likely change the the state to some
+             * other value causing processing to continue when it should 
cease. The AsyncStateMachine will be recycled
+             * as part of the Processor clean-up on CLOSED so it doesn't 
matter what state it is left in at this point.
+             */
+            if (isAsync() && state != SocketState.CLOSED) {
                 state = asyncPostProcess();
                 if (getLog().isDebugEnabled()) {
                     getLog().debug(
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 687590df61..44140d341f 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -126,6 +126,11 @@
         Setting a <code>null</code> value for a cookie attribute should remove
         the attribute. (markt)
       </fix>
+      <fix>
+        Make asynchronous error handling more robust. Ensure that once a
+        connection is marked to be closed, further asynchronous processing
+        cannot change that. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="WebSocket">


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

Reply via email to