RockteMQ-AI commented on issue #1345:
URL: 
https://github.com/apache/rocketmq-clients/issues/1345#issuecomment-5421312187

   **Issue Evaluation — Corrected**
   
   Category: `type/bug` | Status: **Confirmed**
   
   The reported issue has been verified against the current codebase.
   
   **Root Cause:** In `golang/loadBalancer.go`, `NewPublishingLoadBalancer` and 
`CopyAndUpdate` store all message queues without filtering by broker role or 
write permission. The `TakeMessageQueues` method iterates over all stored 
queues, meaning slave brokers (broker ID ≠ 0) and non-writable queues can be 
selected for message publishing.
   
   The subscription (consumer) side already has `isReadableMasterQueue()` for 
filtering, but no equivalent filter exists on the publishing path. The Java SDK 
correctly filters with:
   
   ```java
   mq.getPermission().isWritable() && Utilities.MASTER_BROKER_ID == 
mq.getBroker().getId()
   ```
   
   **Impact:** Go Producer may route messages to slave brokers, causing send 
failures with `service not available now` errors. Affects all Go SDK versions 
(v5.1.2+).
   
   **Severity:** High — causes production message send failures in environments 
with master/slave topology.
   
   **Fix scope:**
   - `NewPublishingLoadBalancer`: filter input queues to only master + writable
   - `CopyAndUpdate`: apply same filter on route refresh
   - Consider adding a `isWritableMasterQueue()` helper mirroring the existing 
`isReadableMasterQueue()`
   
   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]

Reply via email to