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 8eeef2bcf9 Fix regression caused by the fix for BZ 69302
8eeef2bcf9 is described below

commit 8eeef2bcf9dbad0eae7f7c739593fcea9a793770
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Sep 13 16:27:56 2024 +0100

    Fix regression caused by the fix for BZ 69302
---
 java/org/apache/coyote/http2/StreamProcessor.java      | 9 +++++++++
 test/org/apache/coyote/http2/TestHttp2Section_5_1.java | 3 +--
 webapps/docs/changelog.xml                             | 9 +++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/coyote/http2/StreamProcessor.java 
b/java/org/apache/coyote/http2/StreamProcessor.java
index 1f3253b1fa..6c53748d46 100644
--- a/java/org/apache/coyote/http2/StreamProcessor.java
+++ b/java/org/apache/coyote/http2/StreamProcessor.java
@@ -85,6 +85,15 @@ class StreamProcessor extends AbstractProcessor {
             // Note: The regular processor uses the socketWrapper lock, but 
using that here triggers a deadlock
             processLock.lock();
             try {
+                /*
+                 * In some scenarios, error handling may trigger multiple 
ERROR events for the same stream. The first
+                 * ERROR event process will close the stream and recycle it. 
Once the stream has been recycled it should
+                 * not be used for processing any further events. The check 
below ensures that this is the case. In
+                 * particular, Stream.recycle() should not be called more than 
once per Stream.
+                 */
+                if (!stream.equals(handler.getStream(stream.getIdAsInt()))) {
+                    return;
+                }
                 // HTTP/2 equivalent of AbstractConnectionHandler#process() 
without the
                 // socket <-> processor mapping
                 SocketState state = SocketState.CLOSED;
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java 
b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
index 312d5c97be..d72fb03efe 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_5_1.java
@@ -298,8 +298,7 @@ public class TestHttp2Section_5_1 extends Http2TestBase {
         sendRst(3, Http2Error.NO_ERROR.getCode());
         // Client reset triggers both a read error and a write error which in 
turn trigger two server resets
         parser.readFrame();
-        parser.readFrame();
-        Assert.assertEquals("3-RST-[5]\n3-RST-[5]\n", output.getTrace());
+        Assert.assertEquals("3-RST-[5]\n", output.getTrace());
         output.clearTrace();
 
         // Open up the connection window.
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 95037934aa..f12ed97f5f 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -105,6 +105,15 @@
   issues do not "pop up" wrt. others).
 -->
 <section name="Tomcat 9.0.95 (remm)" rtext="in development">
+  <subsection name="Coyote">
+    <changelog>
+      <fix>
+        Fix <bug>69320</bug>, a regression in the fix for <bug>69302</bug> that
+        meant the HTTP/2 processing was likely to be broken for all clients 
once
+        any client sent an HTTP/2 reset frame. (markt)
+      </fix>
+    </changelog>
+  </subsection>
 </section>
 <section name="Tomcat 9.0.94 (remm)" rtext="2024-09-10">
   <subsection name="Catalina">


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

Reply via email to