You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "yuluo-yx (via GitHub)" <gi...@apache.org> on 2026/08/09 04:30:41 UTC

[I] [Bug] BrokerData.selectBrokerAddr crashes for an empty address table [rocketmq]

yuluo-yx opened a new issue, #10873:
URL: https://github.com/apache/rocketmq/issues/10873

   ### Before Creating the Bug Report
   
   - [x] I found a bug, not just a question.
   - [x] I searched open GitHub Issues and pull requests and found no duplicate.
   - [x] I confirmed that this bug belongs to Apache RocketMQ.
   
   ### Runtime platform environment
   
   macOS (Darwin), reproduced with an isolated local unit test.
   
   ### RocketMQ version
   
   Branch: develop
   Git commit: fd0c95920e0deac96ce2ae27442747cc5e65e930
   
   ### JDK Version
   
   Zulu OpenJDK 8 (8.94.0.17)
   
   ### Describe the Bug
   
   BrokerData.selectBrokerAddr assumes brokerAddrs is non-null and non-empty. A default BrokerData instance throws NullPointerException, while an empty map reaches Random.nextInt(0) and throws IllegalArgumentException.
   
   ### Steps to Reproduce
   
   1. Create a default BrokerData and call selectBrokerAddr.
   2. Alternatively, set brokerAddrs to an empty HashMap and call selectBrokerAddr.
   3. Observe the exception.
   
   ### What Did You Expect to See?
   
   The method should return null when no broker address is registered, consistent with its nullable selection result.
   
   ### What Did You See Instead?
   
   The method throws for both null and empty address tables.
   
   ### Additional Context
   
   Master preference and slave fallback remain valid; only the no-address boundary is affected.


-- 
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.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] BrokerData.selectBrokerAddr crashes for an empty address table [rocketmq]

Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on issue #10873:
URL: https://github.com/apache/rocketmq/issues/10873#issuecomment-5229879623

   **Issue Evaluation**
   
   Category: `type/bug` | Status: **Confirmed**
   
   **Root Cause:** `BrokerData.selectBrokerAddr` assumes `brokerAddrs` is non-null and non-empty. A default `BrokerData` instance throws `NullPointerException`, while an empty map reaches `Random.nextInt(0)` and throws `IllegalArgumentException`.
   **Impact:** Broker address selection — callers that invoke `selectBrokerAddr` before broker registration completes will encounter unhandled exceptions instead of a graceful null return.
   **Severity:** medium
   
   ---
   *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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org