RockteMQ-AI commented on issue #11187:
URL: https://github.com/apache/rocketmq/issues/11187#issuecomment-5756671668
**Issue Evaluation**
Category: `type/bug` | Status: **Confirmed**
The reported NPE in `TopicRouteWrapper#getMasterAddr` has been verified
against the current codebase (develop branch).
**Root Cause:** Line 46 in `TopicRouteWrapper.java` calls
`this.brokerNameRouteData.get(brokerName).getBrokerAddrs()` without a null
check. When a broker group is fully deregistered from NameServer (e.g., entire
group goes offline), `brokerNameRouteData` no longer contains that
`brokerName`, so `get()` returns `null`, causing NPE.
**Impact:** Proxy route cache cold-reload fails for the entire topic when
any referenced broker group is offline. The `getMasterAddrPrefer` method (line
50) has the same vulnerability.
**Severity:** High — single broker-group failure takes down the entire topic
routing in Proxy when `orderMessageEnable=true` and static order-topic KV
config references the offline broker.
**Suggested Fix:** Add null-safety in both `getMasterAddr` and
`getMasterAddrPrefer`:
```java
public String getMasterAddr(String brokerName) {
BrokerData data = this.brokerNameRouteData.get(brokerName);
if (data == null) return null;
return data.getBrokerAddrs().get(MixAll.MASTER_ID);
}
```
The caller in `TopicRouteService#buildMessageQueueView` /
`MessageQueueSelector` should also handle null gracefully to skip offline
brokers instead of failing the entire topic route.
An automated fix proposal can be generated. Reply `/approve` to proceed with
PR generation.
---
*Automated evaluation by RockteMQ-AI*
--
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]