You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "nodece (via GitHub)" <gi...@apache.org> on 2026/04/28 05:06:21 UTC
[PR] [fix][broker] Fix race between redeliverUnacknowledgedMessages and expire [pulsar]
nodece opened a new pull request, #25589:
URL: https://github.com/apache/pulsar/pull/25589
### Motivation
`Consumer.redeliverUnacknowledgedMessages` has race conditions with the expire path (`readMoreEntries → removeAllUpTo`), which can corrupt the `unackedMessages` counter:
* The epoch-based variant resets the counter to 0, while expire may concurrently decrement it to a negative value.
* The list-based variant performs `get` and `remove` separately, allowing expire to remove entries in between and causing incorrect redelivery counting.
### Modifications
* Make redelivery operations atomic with respect to expire:
* Add `PendingAcksMap.forEachAndClear()` to atomically iterate and clear all entries under a single lock.
* Add `PendingAcksMap.removeAndGet()` to atomically get and remove entries.
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][broker] Fix race in pending acks removal in redeliverUnacknowledgedMessages [pulsar]
Posted by "nodece (via GitHub)" <gi...@apache.org>.
nodece merged PR #25589:
URL: https://github.com/apache/pulsar/pull/25589
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org