Fix regression caused by the fix for BZ 69320
diff --git a/java/org/apache/coyote/http2/StreamProcessor.java b/java/org/apache/coyote/http2/StreamProcessor.java
index 6a66a79..6bde60d 100644
--- a/java/org/apache/coyote/http2/StreamProcessor.java
+++ b/java/org/apache/coyote/http2/StreamProcessor.java
@@ -85,6 +85,15 @@
// 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 312d5c9..d72fb03 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 @@
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.