[ 
https://issues.apache.org/jira/browse/SOLR-18146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18065077#comment-18065077
 ] 

ASF subversion and git services commented on SOLR-18146:
--------------------------------------------------------

Commit bcc6ccad1a416cfa6adf8d73a112d880d31dca4b in solr's branch 
refs/heads/branch_9x from Jason Gerlowski
[ https://gitbox.apache.org/repos/asf?p=solr.git;h=bcc6ccad1a4 ]

SOLR-18146: Fix race in CircuitBreakerRegistry (#4189)

Global CB loading is now only done by a single thread, and skipped by
whichever threads "lose" that race on startup.

> 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: 10.0, 9.10.1
>            Reporter: Jason Gerlowski
>            Assignee: Jason Gerlowski
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: main(11.0), 10.1
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> 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