[fix][client] Release semaphore before discarding messages in batchMessageContainer
Fixes #17014
Motivation
The root cause of #17014 is a race condition in the batchMessageContainer when discarding the messages and releasing the semaphore. We need to release semaphore first and then discard messages. Otherwise, the user may observe that the semaphore has not been released after receiving the callback of that message.
Modifications
- Release semaphore before discarding messages in batchMessageContainer
Documentation
Check the box below or label this PR directly.
Need to update docs?
-
[ ]
doc-required(Your PR needs to update docs and you will update later) -
[x]
doc-not-needed(Please explain why) -
[ ]
doc(Your PR contains doc changes) -
[ ]
doc-complete(Docs have been already added)
@RobertIndie Please provide a correct documentation label for your PR. Instructions see Pulsar Documentation Label Guide.