RockteMQ-AI commented on issue #10778:
URL: https://github.com/apache/rocketmq/issues/10778#issuecomment-5164358643
**Issue Evaluation**
Category: `type/bug` | Status: **Confirmed**
The reported issue has been verified against the current codebase on the
`develop` branch.
**Root Cause:** In `MessageQueuePenalizer.selectLeastPenaltyWithPriority()`,
the loop iterates over each priority group and calls `selectLeastPenalty()` to
pick the best queue. However, `selectLeastPenalty()` returns `null` when the
input queue list is null or empty (line 67-69). The caller at line 113
immediately dereferences the result via `queueAndPenalty.getRight()` without a
null check, causing `NullPointerException` when any priority bucket is empty.
**Impact:** Proxy route queue selection — any scenario where
`queuesWithPriority` contains an empty inner list before or between non-empty
buckets will crash with NPE instead of gracefully skipping the empty bucket.
**Severity:** medium — runtime crash in Proxy path, but only triggered when
priority groups contain empty buckets (uncommon but possible during broker
topology changes or partial failures).
**Suggested Fix:** Add a null check after `selectLeastPenalty()` returns,
and `continue` to skip empty priority groups:
```java
Pair<Q, Integer> queueAndPenalty = selectLeastPenalty(queues, penalizers,
startIndex);
if (queueAndPenalty == null) {
continue; // skip empty priority group
}
```
An automated fix proposal will be generated. Reply `/approve` to proceed
with PR generation.
---
*Automated evaluation by github-manager-bot*
--
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]