[Bug] in chunk message consumer, pendingChunkedMessageCount is not synced with count of entries present in chunkedMessagesMap
Author: programmerahulCreated Sep 22, 2026Updated Sep 22, 2026
Labelstype/bug
Search before reporting
- I searched in the issues and found nothing similar.
Read release policy
- I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.
User environment
Broker, client version- 4 OS : Mac Sequoia
Issue Description
When the chunked messages assembling is dropped due to out-of order delivery, or normal duplicate chunk, in that case the entires are removed from chunkedMessagesMap but this counter is not decremented pendingChunkedMessageCount. So eventually pendingChunkedMessageCount starts having values higher than the entries in this map chunkedMessagesMap.
Error messages
this cause unnecessary eviction of message by calling removeOldestPendingChunkedMessage, when actual count is still lessReproducing the issue
if the message are being delivered out-of-order, or duplicate messages, then the pendingChunkedMessageCount and count of entries in chunkedMessagesMap diverge
Additional information
No response
Are you willing to submit a PR?
- I'm willing to submit a PR!
Source: apache/pulsar