You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "yyqdbngt (via GitHub)" <gi...@apache.org> on 2026/07/31 14:02:07 UTC
[PR] fix: make consumer group map thread-safe and guard NPE when no brokers [rocketmq-dashboard]
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Studio] Synchronize consumer group cache and handle empty brokers [rocketmq-dashboard]
Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on code in PR #710:
URL: https://github.com/apache/rocketmq-dashboard/pull/710#discussion_r3721571155
##########
src/main/java/org/apache/rocketmq/dashboard/service/impl/ConsumerServiceImpl.java:
##########
@@ -70,6 +70,7 @@
import java.util.List;
Review Comment:
No test changes detected alongside source modifications. Consider adding tests to cover the changes.
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Studio] Synchronize consumer group cache and handle empty brokers [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins closed pull request #710: [Studio] Synchronize consumer group cache and handle empty brokers
URL: https://github.com/apache/rocketmq-dashboard/pull/710
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Studio] Synchronize consumer group cache and handle empty brokers [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins commented on PR #710:
URL: https://github.com/apache/rocketmq-dashboard/pull/710#issuecomment-5252652382
Closing: based on the legacy src/ layout, and the functionality is covered by the rewritten studio implementation. Group listing now goes through MyBatis DB queries (no shared in-memory cache) and DashboardProvider already null-checks both paths.
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org