yyqdbngt opened a new pull request, #710:
URL: https://github.com/apache/rocketmq-dashboard/pull/710

   ### Motivation
   
   Two robustness fixes in `ConsumerServiceImpl`:
   
   1. **`consumerGroupMap` is not thread-safe**
      The map is a plain `HashMap` but is read/written concurrently: 
`queryGroupList`/`makeGroupListCache` mutate it (on request threads), while 
`refreshAllGroup` calls `consumerGroupMap.clear()` without holding the same 
lock and `refreshGroup` reads it directly. This can trigger 
`ConcurrentModificationException` or lost updates. Changed it to a 
`ConcurrentHashMap`.
   
   2. **NPE when the cluster has no brokers**
      In `makeGroupListCache`, `subscriptionGroupWrapper` starts as `null` and 
is only assigned inside the per-broker loop. When the broker table is empty the 
wrapper stays `null`, so `subscriptionGroupWrapper.getSubscriptionGroupTable()` 
throws a `NullPointerException`. The empty/`null` check is now 
`subscriptionGroupWrapper == null || ...isEmpty()` and returns early instead.
   
   ### Verification
   
   `mvn compiler:compile` passes (`BUILD SUCCESS`).
   
   ### Diff
   
   1 file changed, +5 / -2.


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