Jason Gerlowski created SOLR-18146:
--------------------------------------

             Summary: ArrayIndexOutOfBoundsException in global CircuitBreaker 
initialization
                 Key: SOLR-18146
                 URL: https://issues.apache.org/jira/browse/SOLR-18146
             Project: Solr
          Issue Type: Bug
          Components: Circuit Breakers
    Affects Versions: 9.10.1, 10.0
            Reporter: Jason Gerlowski


I recently ran into an ArrayIndexOutOfBoundsException on Solr startup, when 
multiple cores are loading in parallel and each attempt to parse and load the 
"global" circuit breakers.

The problem is the code below, which can be called from multiple threads doing 
core-loads:

{code}
  /** Register a global circuit breaker */
  public static void registerGlobal(CircuitBreaker circuitBreaker) {
    circuitBreaker
        .getRequestTypes()
        .forEach(
            r -> {
              List<CircuitBreaker> list =
                  globalCircuitBreakerMap.computeIfAbsent(r, k -> new 
ArrayList<>());
              list.add(circuitBreaker);
            });
  }
{code}

"globalCircuitBreakerMap" was changed a few releases back to a 
ConcurrentHashMap (see SOLR-17761) which solves some problems.  But the 
"ArrayList" instances used as values in this global map are also thread-unsafe. 
 So multiple core-load threads racing to bootstrap the global circuit breakers 
can trigger an ArrayIndexOutOfBoundsException if they end up processing the 
same "request-type" at the same time.





--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to