[
https://issues.apache.org/jira/browse/SOLR-18146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18064228#comment-18064228
]
ASF subversion and git services commented on SOLR-18146:
--------------------------------------------------------
Commit 26c7e78e85fbdee69e7e765359beac289f464526 in solr's branch
refs/heads/branch_10x from Jason Gerlowski
[ https://gitbox.apache.org/repos/asf?p=solr.git;h=26c7e78e85f ]
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
> Priority: Minor
> Labels: pull-request-available
> 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]