dsmiley opened a new pull request, #4176:
URL: https://github.com/apache/solr/pull/4176

   Recent improvements induced a new race condition caught by a flaky test.  
State sometimes isn't refreshed.
   
   https://issues.apache.org/jira/browse/SOLR-18142
    
   
   See `CloudSolrClientCacheTest.testStaleStateRetryWaitsAfterSkipFailure`
   
   The Race Condition:                                                          
                                                                                
          
       - Thread 1: getDocCollection() triggers refresh → creates 
CompletableFuture → calls ref.get() (refGets=1) → future completes              
                              
       - Thread 2 (async): Future completion callback runs to remove it from 
collectionRefreshes map                                                         
                  
       - Race Window: Between future completing and callback removing it from 
map                                                                             
                 
       - Thread 1: Detects INVALID_STATE error → calls 
triggerCollectionRefresh() again                                                
                                        
       - If callback hasn't run yet, computeIfAbsent finds the completed future 
→ returns it without calling ref.get() again                                    
               
       - Result: refGets stays at 1 instead of 2 → test fails                   
    
   
   Solution is to use `compute` so that we can differentiate a Future that's 
already done/completed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to