Repository navigation
[fix] [client] Fix memory leak when publishing encountered a corner case error - #23738
Merged
Merged
Conversation
poorbarcode
requested review from
Technoboy-,
codelipenghui,
gaoran10,
lhotari and
shibd
December 16, 2024 12:38
Contributor
Author
|
/pulsarbot rerun-failure-checks |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #23738 +/- ##
============================================
+ Coverage 73.57% 74.31% +0.73%
+ Complexity 32624 2374 -30250
============================================
Files 1877 1838 -39
Lines 139502 143053 +3551
Branches 15299 16232 +933
============================================
+ Hits 102638 106304 +3666
+ Misses 28908 28376 -532
- Partials 7956 8373 +417
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…ucerImpl.java Co-authored-by: Yunze Xu <[email protected]>
poorbarcode
requested review from
BewareMyPower
and removed request for
BewareMyPower
December 19, 2024 07:24
…dMessageBuilderImpl.java
BewareMyPower
approved these changes
Dec 20, 2024
Member
|
@poorbarcode @BewareMyPower Please review #23761, that addresses a long time issue where the completable futures of pending messages weren't completed when close was called. It's also a case which could result into a resource leak situation. |
lhotari
pushed a commit
that referenced
this pull request
Dec 20, 2024
…ase error (#23738) Co-authored-by: Yunze Xu <[email protected]> (cherry picked from commit ab1b5c0)
lhotari
pushed a commit
that referenced
this pull request
Dec 20, 2024
…ase error (#23738) Co-authored-by: Yunze Xu <[email protected]> (cherry picked from commit ab1b5c0)
lhotari
pushed a commit
that referenced
this pull request
Dec 20, 2024
…ase error (#23738) Co-authored-by: Yunze Xu <[email protected]> (cherry picked from commit ab1b5c0)
nikhil-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Dec 26, 2024
…ase error (apache#23738) Co-authored-by: Yunze Xu <[email protected]> (cherry picked from commit ab1b5c0) (cherry picked from commit 7915b66)
srinath-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Dec 26, 2024
…ase error (apache#23738) Co-authored-by: Yunze Xu <[email protected]> (cherry picked from commit ab1b5c0) (cherry picked from commit 7915b66)
hanmz
pushed a commit
to hanmz/pulsar
that referenced
this pull request
Feb 12, 2025
…ase error (apache#23738) Co-authored-by: Yunze Xu <[email protected]>
nodece
added a commit
to nodece/pulsar
that referenced
this pull request
Sep 14, 2026
…ls it Two review findings on apache#26455, both queue/buffer paths left stranded by a failure: - processOpSendMsg's catch (from apache#23738) released only the permit and the memory when the body threw - realistically when the connection's event loop rejected the write task while shutting down. The op stayed in pendingMessages unrecycled, its cmd leaked both references (the op's own and the one retained for a write that never got queued), and a chunked op's ChunkedMessageCtx claim leaked with it. The catch now takes the op back out of the queue (OpSendMsgQueue gained a remove(OpSendMsg) that keeps the message-count accounting; the iterator's remove already did), drops the orphaned write reference, and releases the op's own command via releaseOpCmdAndRecycle, whose inline fallback covers the rejecting event loop. - In the resend recovery loop, a rebuilt command that exceeds the max message size took the isMessageSizeExceeded path, which already released the accounting and completed the callback - but the bare continue left the op in pendingMessages with its fresh cmd, so it sat until the send timeout failed it and released the accounting a second time. The continue now removes the op from the iteration and releases its command and the op itself. Regression test drives the real processOpSendMsg with an event loop that rejects every task and asserts the queue is empty, the accounting follows, and the cmd reaches refCnt 0 (fails with "expected [0] but found [1]" queue residue on the previous code). Assisted-by: Claude Code
2 tasks done
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.
Motivation
Issue 1: memory leak if get errors when publishing
Conditions:
max message sizeProducerInterceptor. eligibletestSendQueueIsFull,testSendMessageSizeExceeded,testSendAfterClosedProducer, andtestInterceptorErrorModifications
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: x