RockteMQ-AI commented on issue #10945:
URL: https://github.com/apache/rocketmq/issues/10945#issuecomment-5370234500

   Hi @Aias00, thanks for reporting this!
   
   I've analyzed this issue against the codebase and can confirm this appears 
to be a **real bug**.
   
   **Root Cause:** In `PopConsumerService.java:437`, the loop over 
`getMessageResultList` (one entry per fetch result) uses the same index `i` to 
index into `popConsumerRecordList` (one entry per message, flattened). When any 
prior `GetMessageResult` contains more than one message, the indices diverge — 
result index `i` no longer maps to the first `PopConsumerRecord` for that 
result. A retry result can therefore be looked up as a normal record and skip 
retry-message recoding.
   **Affected Files:** 
`broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java`, 
`broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerContext.java`
   
   **Analysis:** `PopConsumerContext.addGetMessageResult` adds one 
`GetMessageResult` per call but adds N `PopConsumerRecord`s (one per message 
offset). The consuming loop in `PopConsumerService` assumes a 1:1 mapping by 
using the same index for both lists, which is only correct when every result 
has exactly one message.
   
   I'll prepare a fix spec and work on a PR. The community is welcome to 
provide feedback on the approach before implementation.
   
   ---
   🤖 *Automated issue analysis by github-manager*


-- 
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