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

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


The following commit(s) were added to refs/heads/main by this push:
     new ecac3962a6 Only dispatch the error notification once when an HTTP/2 
stream is reset
ecac3962a6 is described below

commit ecac3962a655e1c7171030157a80a967406f511e
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Nov 27 09:58:27 2026 +0000

    Only dispatch the error notification once when an HTTP/2 stream is reset
    
    Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
---
 java/org/apache/coyote/http2/Stream.java | 6 ++++--
 webapps/docs/changelog.xml               | 5 +++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index 6893955b05..2c296bd119 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -1389,6 +1389,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
         private volatile long readTimeoutExpiry;
         private volatile boolean closed;
         private volatile boolean resetReceived;
+        private volatile boolean resetErrorDispatched;
 
         @Override
         public final int doRead(ApplicationBufferHandler 
applicationBufferHandler) throws IOException {
@@ -1644,9 +1645,10 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
              * StreamProcessor recycling the Stream. The use of recycledLock 
ensures that an attempt is not made to
              * notify the ReadListener after the Stream has been recycled.
              */
-            if (!recycled) {
+            if (!recycled && !resetErrorDispatched) {
                 synchronized (recycledLock) {
-                    if (!recycled) {
+                    if (!recycled && !resetErrorDispatched) {
+                        resetErrorDispatched = true;
                         // Trigger ReadListener.onError()
                         
getCoyoteRequest().setAttribute(RequestDispatcher.ERROR_EXCEPTION,
                                 new 
IOException(sm.getString("stream.clientResetRequest")));
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 4e917f35c4..372ecab8ab 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -503,6 +503,11 @@
       <fix>
         Improve performance of String based URI normalization. (markt)
       </fix>
+      <fix>
+        Ensure that, when a client resets an HTTP/2 stream, the error
+        notification for the request is only dispatched once, even if the reset
+        is processed more than once. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to