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

[I] [Bug] Unexpected decrement of lmq counter [rocketmq]

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

   ### 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
   
   .
   
   ### RocketMQ version
   
   .
   
   ### JDK Version
   
   .
   
   ### Describe the Bug
   
   We previously implemented an LMQ counting mechanism and have now discovered an unexpected counter underflow issue in RocksDBConsumeQueueOffsetTable.
   
   ### Steps to Reproduce
   
   When specific get* operation is called for a non-existent LMQ topic, a sentinel value -1L is placed into topicQueueMaxCqOffset without incrementing lmqCounter. However, if this topic is later deleted, removeHeapMaxCqOffset unconditionally decrements lmqCounter, causing the counter to underflow.
   
   ### What Did You Expect to See?
   
   lmqCounter should not be decremented for entries that were never actually counted.
   
   ### What Did You See Instead?
   
   .
   
   ### Additional Context
   
   .


-- 
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] Unexpected decrement of lmq counter [rocketmq]

Posted by "oss-sentinel-ai (via GitHub)" <gi...@apache.org>.
oss-sentinel-ai commented on issue #10453:
URL: https://github.com/apache/rocketmq/issues/10453#issuecomment-4656296174

   ## Assessment by github-manager-bot
   
   **Classification:** 🐛 Bug
   
   ### Summary
   The issue reports an LMQ counter underflow bug in `RocksDBConsumeQueueOffsetTable`:
   - When a `get*` operation is called for a non-existent LMQ topic, a sentinel value `-1L` is placed into `topicQueueMaxCqOffset` **without incrementing `lmqCounter`**
   - When this topic is later deleted, `removeHelperTopic` decrements `lmqCounter`, causing an unexpected underflow
   
   ### Analysis
   This is a valid bug report from a known contributor. The issue describes a specific code path where:
   1. **Creation path**: Non-existent topic lookup → sentinel value inserted → counter NOT incremented
   2. **Deletion path**: Topic deleted → counter decremented → **underflow**
   
   This is a classic counter mismatch bug that can lead to incorrect LMQ topic counts.
   
   ### Recommendation
   ✅ **Valid bug.** The root cause is clear: the sentinel value insertion path doesn't maintain the counter invariant. A fix should either:
   - Increment `lmqCounter` when inserting the sentinel value, OR
   - Track sentinel entries separately and skip counter decrement for them during deletion
   
   This requires maintainer review to confirm the fix approach.
   
   ---
   *Automated assessment 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


Re: [I] [Bug] Unexpected decrement of lmq counter [rocketmq]

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

   **Issue Evaluation**
   
   Category: `type/bug` | Status: **Needs Verification**
   
   Thank you for reporting this issue. To proceed with verification, please provide:
   - [ ] Version/tag or commit hash where this occurs
   - [ ] Steps to reproduce
   - [ ] Expected vs actual behavior
   - [ ] Relevant logs or stack traces
   
   ---
   *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: commits-unsubscribe@rocketmq.apache.org

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