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

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


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 66ff125f1d Fix race in HTTP/2 async CLOSE_CLEAN tests
66ff125f1d is described below

commit 66ff125f1d907f2b780286244b55ea51fc2f338a
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 c676e075a5..feb15daa8f 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