You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "iloveeyjafjalla (via GitHub)" <gi...@apache.org> on 2026/10/12 02:28:35 UTC

[I] [Bug] AdminSendMessage maps a FIFO message group to a different queue than the data plane [rocketmq]

iloveeyjafjalla opened a new issue, #11356:
URL: https://github.com/apache/rocketmq/issues/11356

   ### Before Creating the Bug Report
   
   - [x] I found a bug, not just asking a question, which should be created in [GitHub Discussions](https://github.com/apache/rocketmq/discussions).
   - [x] I have searched the [GitHub Issues](https://github.com/apache/rocketmq/issues) and [GitHub Discussions](https://github.com/apache/rocketmq/discussions) of this repository and believe that this is not a duplicate.
   - [x] I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.
   
   ### Runtime platform environment
   
   OS: Windows 11 / Linux (proxy module, platform independent)
   
   ### RocketMQ version
   
   branch: develop
   Git commit id: 9ea2ccdc2b41445aee5e177e14e501d606f5a1ed (2026-10-08)
   
   ### JDK Version
   
   Compiler: Temurin 1.8.0_504 (target 1.8, same as CI)
   
   ### Describe the Bug
   
   `AdminSendMessage` (Proxy Admin gRPC surface) routes a message that carries a message group through a
   different hash than the gRPC data plane, so a FIFO group's messages can be split over several queues.
   
   The admin path hashes the group with plain modulo
   (`proxy/src/main/java/org/apache/rocketmq/proxy/grpc/admin/ProxyAdminGrpcService.java`, `selectQueue`):
   
   ```java
   int index = Math.floorMod(shardingKey.hashCode(), queues.size());
   ```
   
   the data plane hashes the same key with Guava's consistent hash
   (`proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/producer/SendMessageActivity.java:414`):
   
   ```java
   int bucket = Hashing.consistentHash(shardingKey.hashCode(), writeQueues.size());
   ```
   
   The two functions disagree for the same key and queue count (for message group `groupA-fifo` over 3 writable
   queues, `floorMod` picks index 2 while `consistentHash` picks index 0), so a message injected through the admin
   surface lands on a queue that the group's own producers never write to. `selectQueue`'s own javadoc states the
   intent ("A FIFO message must keep going to the queue its message group hashes to") and `docs/proxy-admin.md`
   documents the admin send path as "system properties honoured for timer / FIFO messages", so the mapping is
   meant to match the data plane.
   
   Impact: per-group FIFO ordering is silently violated for that group (messages are only ordered within one
   queue), and a second consumer can pick up the admin message from the other queue. The RPC still answers with
   `OK`, so nothing tells the operator the group was split.
   
   ### Steps to Reproduce
   
   1. Run a proxy with `grpcAdminServerEnable=true` and a topic that has at least 3 writable queues.
   2. Produce FIFO messages for message group `g` with a gRPC producer — the data plane writes them to queue
      `Hashing.consistentHash(g.hashCode(), writeQueues.size())`.
   3. Send a message for the same group through the admin surface: `AdminSendMessage` with
      `system_properties.message_group = "g"`.
   4. Observe that the admin message is written to queue `Math.floorMod(g.hashCode(), writeQueues.size())`, which
      is usually a different queue than the group's messages use.
   
   ### Expected behavior
   
   A message the admin surface sends for a message group lands on the same queue the data plane hashes that group
   to, so the group keeps its FIFO order.
   
   ### Actual behavior
   
   The message can be written to a different queue than the group's messages (status `OK`, no warning).
   
   ### Additional context
   
   Minimal fix: use the same hash function the data plane uses in `ProxyAdminGrpcService#selectQueue`, and cover
   the parity with a unit test on the `QueueSelector` the RPC hands to `MessagingProcessor#sendMessage`.
   


-- 
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] AdminSendMessage maps a FIFO message group to a different queue than the data plane [rocketmq]

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

   **Issue Evaluation**
   
   Category: `type/bug` | Status: **Confirmed**
   
   The reported issue has been verified against the current codebase on the `develop` branch.
   
   **Root Cause:** `ProxyAdminGrpcService.selectQueue()` uses `Math.floorMod(shardingKey.hashCode(), queues.size())` to map a FIFO message group to a queue, while the gRPC data plane in `SendMessageActivity` (line 414) uses `Hashing.consistentHash(shardingKey.hashCode(), writeQueues.size())`. These two hash functions disagree for the same key and queue count, so an admin-sent FIFO message lands on a different queue than the one the data-plane producers use for the same message group.
   
   **Impact:** Per-group FIFO ordering is silently violated when messages are injected through the admin surface. A second consumer may pick up the admin message from a different queue. The RPC still returns OK, giving no indication of the split.
   
   **Severity:** Medium — affects FIFO ordering guarantees for admin-sent messages; data-plane-only FIFO flows are unaffected.
   
   **Suggested Fix:** Align `ProxyAdminGrpcService.selectQueue()` to use the same Guava `Hashing.consistentHash` path as `SendMessageActivity`, or extract a shared helper so both surfaces hash the sharding key identically.
   
   An automated fix proposal may 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: commits-unsubscribe@rocketmq.apache.org

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