-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Broker] waitingCursors potential heap memory leak #13939
[Broker] waitingCursors potential heap memory leak #13939
Conversation
@gaozhangmin:Thanks for your contribution. For this PR, do we need to update docs? |
@gaozhangmin:Thanks for providing doc info! |
@gaozhangmin I'm not sure I see the case where the cursor is added multiple times:
This is called only the first time, as a kind of optimization to avoid inserting in the queue for cases where consumer and producers are very close. After the first time is unsuccessful, then we insert in the queue and wait for the notification. There shouldn't be more than 1 entry per cursor in that queue. |
@merlimat You can verify by this test
|
This maybe will not cause memory leak, it's not a periodic task. constantly creating and shutting down consumers can lead to this problem.
|
4834395
to
96bc879
Compare
9018954
to
718120c
Compare
/pulsarbot run-failure-checks |
@liudezhi2098 Please help review this Pr, thanks a lot. |
121f0b3
to
16ff5c3
Compare
16ff5c3
to
878bd6b
Compare
@merlimat PTAL |
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/ManagedLedger.java
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/CreateSubscriptionTest.java
Outdated
Show resolved
Hide resolved
…ateSubscriptionTest.java Co-authored-by: lipenghui <penghui@apache.org>
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
(cherry picked from commit 478fd36)
(cherry picked from commit 478fd36)
(cherry picked from commit 478fd36)
Motivation
org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl#waitingCursors
has memory leak problem, reproduced steps:Reproduce test: I don't know why getWaitingCursorsCount aways 1 less than for loop count.
Detail:
pulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
Lines 807 to 809 in a18f8a1
org.apache.bookkeeper.mledger.impl.ManagedCursorImpl#checkForNewEntries
pulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java
Lines 788 to 806 in a18f8a1
org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl#notifyCursors
pulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
Lines 2219 to 2228 in a18f8a1
Modifications
1、remove cursor when consumer closed.
Documentation
Check the box below or label this PR directly (if you have committer privilege).
Need to update docs?
doc-required
(If you need help on updating docs, create a doc issue)
no-need-doc
(Please explain why)
doc
(If this PR contains doc changes)