RockteMQ-AI commented on issue #1340: URL: https://github.com/apache/rocketmq-clients/issues/1340#issuecomment-5370300851
Hi @qianye1001, thanks for reporting this! I've analyzed this issue against the codebase and can confirm this appears to be a **real bug**. **Root Cause:** `ProcessQueueImpl.receiveMessage(String)` schedules a fixed 1-second backoff via `receiveMessageLater(RECEIVING_BACKOFF_DELAY_WHEN_CACHE_IS_FULL, attemptId)` whenever `isCacheFull()` is true, but `evictCache(MessageViewImpl)` only removes messages from the local cache after ACK/NACK completion and never resumes the paused receive loop. Therefore, even if consumption drains the cache immediately, the queue still waits the full one-second timer before issuing the next receive request. **Affected Files:** java/client/src/main/java/org/apache/rocketmq/client/java/impl/consumer/ProcessQueueImpl.java, java/client/src/main/java/org/apache/rocketmq/client/java/impl/consumer/PushConsumerImpl.java **Analysis:** The per-queue thresholds are computed by dividing total cache limits by the number of assigned queues (`PushConsumerImpl.cacheMessageCountThresholdPerQueue()` / `cacheMessageBytesThresholdPerQueue()`). With many queues the quota per queue is small, so the cache fills quickly. Once full, the receive loop pauses for `RECEIVING_BACKOFF_DELAY_WHEN_CACHE_IS_FULL` (1s). Because cache eviction (`eraseMessage`, `discardMessage`, etc.) does not signal or reschedule the receive loop, the queue cannot resume early, causing repeated one-second gaps and reduced throughput when server-side backlog is high. This matches the issue description exactly. 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]
