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

markt-asf 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 52c4b4efc3 Fix race in HTTP/2 async CLOSE_CLEAN tests
52c4b4efc3 is described below

commit 52c4b4efc3f08e93dc5f70045fd3a36fad5c194c
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Nov 30 13:06:43 2026 +0000

    Fix race in HTTP/2 async CLOSE_CLEAN tests
    
    The test released its latch from inside the servlet, but the processor is
    only added to the waiting processors once service() returns. Wait for the
    processor to be registered before continuing.
    
    Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
---
 .../apache/coyote/http2/TestStreamProcessorAsyncCloseClean.java   | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git 
a/test/org/apache/coyote/http2/TestStreamProcessorAsyncCloseClean.java 
b/test/org/apache/coyote/http2/TestStreamProcessorAsyncCloseClean.java
index 9f848463b3..766299cab3 100644
--- a/test/org/apache/coyote/http2/TestStreamProcessorAsyncCloseClean.java
+++ b/test/org/apache/coyote/http2/TestStreamProcessorAsyncCloseClean.java
@@ -236,6 +236,14 @@ public class TestStreamProcessorAsyncCloseClean extends 
Http2TestBase {
         if (!inService.await(WAIT_LIMIT, TimeUnit.MILLISECONDS)) {
             Assert.fail("Request did not reach the servlet");
         }
+        // The latch is released from inside the servlet. The processor is 
only added to the waiting processors once
+        // service() has returned on the container thread. Wait for that, else 
the tests can check, or send data,
+        // before the processor is registered.
+        long end = System.currentTimeMillis() + WAIT_LIMIT;
+        while (waitingProcessors() == 0 && System.currentTimeMillis() < end) {
+            Thread.sleep(10);
+        }
+        Assert.assertEquals(1, waitingProcessors());
         return asyncContext.get();
     }
 


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

Reply via email to