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

janhoy pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new b522264212b SOLR-18174 Fix test race condition failure in 
AsyncTrackerSemaphoreLeakTest (#4331)
b522264212b is described below

commit b522264212bdbc1d08b2590f2076df672bf63635
Author: Jan Høydahl <[email protected]>
AuthorDate: Mon Apr 27 23:44:12 2026 +0200

    SOLR-18174 Fix test race condition failure in AsyncTrackerSemaphoreLeakTest 
(#4331)
    
    (cherry picked from commit 2093185efaffa5e6677125c54db7fd3151bb6bf1)
---
 .../solr/handler/component/AsyncTrackerSemaphoreLeakTest.java | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git 
a/solr/core/src/test/org/apache/solr/handler/component/AsyncTrackerSemaphoreLeakTest.java
 
b/solr/core/src/test/org/apache/solr/handler/component/AsyncTrackerSemaphoreLeakTest.java
index 11e34dd3257..f8e2a31cba5 100644
--- 
a/solr/core/src/test/org/apache/solr/handler/component/AsyncTrackerSemaphoreLeakTest.java
+++ 
b/solr/core/src/test/org/apache/solr/handler/component/AsyncTrackerSemaphoreLeakTest.java
@@ -208,7 +208,16 @@ public class AsyncTrackerSemaphoreLeakTest extends 
SolrCloudTestCase {
                 + " fires synchronously on the IO thread before onComplete can 
release().");
       }
 
-      int permitsAfterFailures = testClient.asyncTrackerAvailablePermits();
+      // Poll briefly: apiFutures complete on the executor thread, but 
completeListener fires on
+      // Jetty's IO thread after response listeners, so allOf().get() can race 
ahead of release().
+      int permitsAfterFailures;
+      long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(5);
+      do {
+        permitsAfterFailures = testClient.asyncTrackerAvailablePermits();
+        if (permitsAfterFailures == MAX_PERMITS) break;
+        //noinspection BusyWait
+        Thread.sleep(10);
+      } while (System.nanoTime() < deadline);
       log.info("Permits after retries: {}/{}", permitsAfterFailures, 
MAX_PERMITS);
       assertEquals(
           "All permits should be restored after retries complete",

Reply via email to