-
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
[fix] [client] Fix resource leak in Pulsar Client since HttpLookupService doesn't get closed #22858
[fix] [client] Fix resource leak in Pulsar Client since HttpLookupService doesn't get closed #22858
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's actual a memory leak. This PR only clears the map after closeAsync
is called. However, I could hardly think of a case that a PulsarClient
is still used after closeAsync
. When the PulsarClientImpl
object is GC'ed, this map will be GC'ed as well.
pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@BewareMyPower I agree. I renamed "memory leak" to "resource leak" in the title. /cc @poorbarcode Threads get leaked since the underlying HttpClient of the HttpLookupService doesn't get closed. |
pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java
Show resolved
Hide resolved
/pulsarbot rerun-failure-checks |
…vice doesn't get closed (apache#22858) (cherry picked from commit bc3dc77) (cherry picked from commit e9264a9)
…vice doesn't get closed (apache#22858) (cherry picked from commit bc3dc77) (cherry picked from commit e9264a9)
…vice doesn't get closed (apache#22858) (cherry picked from commit bc3dc77) (cherry picked from commit e9264a9)
…vice doesn't get closed (apache#22858) (cherry picked from commit bc3dc77) (cherry picked from commit e9264a9)
Motivation
#21356 added a resource map
urlLookupMap
inPulsarClientImpl.class
, but did not release the lookup services when closing PulsarClient.Modifications
Release
urlLookupMap
when closing PulsarClientDocumentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: x