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

markt 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 d6e5a08843 Fix regression caused by the fix for BZ 69320
d6e5a08843 is described below

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

    Fix regression caused by the fix for BZ 69320
---
 java/org/apache/coyote/http2/StreamProcessor.java      | 9 +++++++++
 test/org/apache/coyote/http2/TestHttp2Section_5_1.java | 3 +--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/coyote/http2/StreamProcessor.java 
b/java/org/apache/coyote/http2/StreamProcessor.java
index 6a66a793c2..6bde60d921 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.


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

Reply via email to