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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
     new 2436c18  Fix (hopefully) intermittently failing test
2436c18 is described below

commit 2436c1808efb1f3b5c8847ae6a1c718e0748cbc2
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Nov 29 17:09:45 2021 +0000

    Fix (hopefully) intermittently failing test
---
 java/org/apache/coyote/http2/Stream.java | 10 ++++++++--
 webapps/docs/changelog.xml               |  6 ++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index 1c5d6c7..12e507d 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -614,8 +614,14 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
                     log.debug(sm.getString("stream.reset.send", 
getConnectionId(), getIdAsString(),
                             se.getError()));
                 }
-                state.sendReset();
-                handler.sendStreamReset(se);
+                // Sync ensures that if the call to sendReset() triggers resets
+                // in other threads, that the RST frame associated with this
+                // thread is sent before the RST frames associated with those
+                // threads.
+                synchronized (state) {
+                    state.sendReset();
+                    handler.sendStreamReset(se);
+                }
                 cancelAllocationRequests();
                 if (inputBuffer != null) {
                     inputBuffer.swallowUnread();
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 9a9af08..49f30a4 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -155,6 +155,11 @@
         Refactor APR/native connector shutdown to remove a potential source of
         JVM crashes on shutdown when sendfile is used. (markt)
       </fix>
+      <fix>
+        When an error occurs that triggers a stream reset, ensure that the 
first
+        <code>RST</code> frame sent to the client is the one associated with 
the
+        error that triggered the reset. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Other">
@@ -10268,3 +10273,4 @@
 </section>
 </body>
 </document>
+

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

Reply via email to