You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2024/01/24 15:01:16 UTC

(tomcat) branch 9.0.x updated: Make asynchronous error handling more robust.

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


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

commit b94ecd1b69d0fa6a0568c0f10fd90baa235cf062
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                         | 11 ++++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

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 50d81ad9ac..2b7e17db88 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -120,7 +120,16 @@
       </fix>
     </changelog>
   </subsection>
- <subsection name="WebSocket">
+  <subsection name="Coyote">
+    <changelog>
+      <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">
     <changelog>
       <fix>
         Correct a regression in the fix for <bug>66508</bug> that could cause an


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