You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: Queue size incorrect when IOException thrown #2736
@mattrpav, I'd like to submit a PR for this issue if that's OK with you. Here's my understanding of the problem:
The Problem
In Queue.messageExpired(), the expired count is incremented before removing the message. An IOException during removal is only logged.
The queue-size decrement happens later in dropMessage(), after successful acknowledgement. A failed acknowledgement can therefore leave the queue count unchanged.
Message.canProcessAsExpired() uses a one-way atomic flag to prevent repeat expiration processing. This makes a naïve “try again on the next scan” approach insufficient.
Some expiration paths also remove the message from the pending cursor before attempting store removal, so preserving access to the failed message matters.
Recommended approach
Inject a one-time IOException during removal of a persistent expired message.
Reproduce the stuck queue count.
Make failed expiration removal recoverable, while avoiding duplicate DLQ forwarding, repeated expired-count increments, and double dequeues.
Verify that, after storage recovers, removal completes and queue size reaches zero. Also test repeated failures and normal expiration.
Existing expiration tests and ProxyMessageStore test patterns provide a useful starting point.
Activity
ruthst00 commentedon Nov 19, 2026
@mattrpav, I'd like to submit a PR for this issue if that's OK with you. Here's my understanding of the problem:
The Problem
Queue.messageExpired(), the expired count is incremented before removing the message. AnIOExceptionduring removal is only logged.dropMessage(), after successful acknowledgement. A failed acknowledgement can therefore leave the queue count unchanged.Message.canProcessAsExpired()uses a one-way atomic flag to prevent repeat expiration processing. This makes a naïve “try again on the next scan” approach insufficient.Recommended approach
IOExceptionduring removal of a persistent expired message.Existing expiration tests and
ProxyMessageStoretest patterns provide a useful starting point.mattrpav commentedon Nov 19, 2026
@ruthst00 I already have a PR for this one in review. It is very nuanced, and would not suggest this one for a new contributor.