AnonHxy opened a new pull request, #16953:
URL: https://github.com/apache/pulsar/pull/16953

   
   
   Fixes https://github.com/apache/pulsar/issues/16952
   
   ### Motivation
   
   * Fix ConcurrentModificationException when ModularLoadManagerImpl start. The 
root cause is that `ModularLoadManagerImpl#knownBrokers` can be modified in 
multi-thread through `ModularLoadManagerImpl#updateAll`
        *  Thread-1 is line290:
        
https://github.com/apache/pulsar/blob/5c09d536304e5873c4e1ceeb8353a1150b5d61f4/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java#L282-L292
        *  Thread-2 is line969
        
https://github.com/apache/pulsar/blob/5c09d536304e5873c4e1ceeb8353a1150b5d61f4/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java#L938-L970
   
   ### Modifications
   
   * Changing `ModularLoadManagerImpl#knownBrokers` to 
`ConcurrentHashMap.newKeySet()`
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   
   ### Documentation
   
   Check the box below or label this PR directly.
   
   Need to update docs? 
   
   - [ ] `doc-required` 
   (Your PR needs to update docs and you will update later)
     
   - [x] `doc-not-needed` 
   (Please explain why)
     
   - [ ] `doc` 
   (Your PR contains doc changes)
   
   - [ ] `doc-complete`
   (Docs have been already added)


-- 
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]

Reply via email to