[fix][broker] Fix deadlock in Key_Shared PIP-379 implementation#23854
Merged
Conversation
heesung-sohn
approved these changes
Jan 16, 2025
lhotari
added a commit
that referenced
this pull request
Jan 16, 2025
(cherry picked from commit 8f04945)
poorbarcode
pushed a commit
to poorbarcode/pulsar
that referenced
this pull request
Jan 23, 2025
3 tasks
hanmz
pushed a commit
to hanmz/pulsar
that referenced
this pull request
Feb 12, 2025
3 tasks
singhvishalkr
added a commit
to singhvishalkr/pulsar
that referenced
this pull request
Apr 21, 2026
…y to DEBUG The `log.warn()` call in `DrainingHashesTracker.ConsumerDrainingHashesStats #updateConsumerStats` fires whenever the hash-iterator observes an entry that was already removed by a concurrent write path. In the original PIP-379 design the draining-hash stats were strongly consistent with the tracker state, so a missing entry on the read path was genuinely unexpected. That strong-consistency guarantee was intentionally dropped in apache#23854 to resolve a deadlock: the stats path is now allowed to race with entry removal. A missing entry is therefore a benign, expected outcome during normal operation, not a signal worth alerting on. Logging this at `WARN` floods broker logs without a corresponding actionable condition. Drop it to `DEBUG` and add an inline comment explaining the race so future readers understand why this is deliberately quiet. Fixes apache#25277
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #23848
Motivation
The Pulsar 4.0 Key_Shared PIP-379 implementation could deadlock and this problem was first captured in test environment heapdump where the thread stack information included in the heapdump showed multiple threads in blocked state, hinting a deadlock.
With the help of @pdolif, the problem was reproduced in isolation by simply adding this type of test code in a KeySharedSubscriptionTest test case.
In the test case, this triggered a similar pattern of blocked threads and therefore could be considered a reproduction of the previously faced dead lock issue in a test environment.
threaddump with deadlock:
Modifications
Documentation
docdoc-requireddoc-not-neededdoc-complete