File tree Expand file tree Collapse file tree
solr/core/src/test/org/apache/solr/handler/component Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -204,7 +204,16 @@ public void testSemaphoreLeakOnLBRetry() throws Exception {
204204 + " fires synchronously on the IO thread before onComplete can release()." );
205205 }
206206
207- int permitsAfterFailures = testClient .asyncTrackerAvailablePermits ();
207+ // Poll briefly: apiFutures complete on the executor thread, but completeListener fires on
208+ // Jetty's IO thread after response listeners, so allOf().get() can race ahead of release().
209+ int permitsAfterFailures ;
210+ long deadline = System .nanoTime () + TimeUnit .SECONDS .toNanos (5 );
211+ do {
212+ permitsAfterFailures = testClient .asyncTrackerAvailablePermits ();
213+ if (permitsAfterFailures == MAX_PERMITS ) break ;
214+ //noinspection BusyWait
215+ Thread .sleep (10 );
216+ } while (System .nanoTime () < deadline );
208217 log .info ("Permits after retries: {}/{}" , permitsAfterFailures , MAX_PERMITS );
209218 assertEquals (
210219 "All permits should be restored after retries complete" ,
You can’t perform that action at this time.
0 commit comments