-
Notifications
You must be signed in to change notification settings - Fork 910
Possible Memory Leak - Connection Reaper #1679
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
Comments
Thanks for the report. Looks like I spoke too soon; looking over the code again, everything seems in order. And doing a simple test continuously creating a client, making a request, and closing it keeps the reaper map size at 0. Do you have a repro case that we can run? |
Thank you for the quick response @dagnir I have reviewed our code and found a couple instances where Not sure if it matters but here are the SDK clients we are using and how we are instantiating each of them.
|
I tried creating multiple sdk clients, making api calls, and then closing the clients but was not able to reproduce the issue. (verified that Could you provide a complete repro case? |
We were not able to reproduce it, closing this due to no response. Please feel free to reopen if you are still experiencing this issue and can provide us a complete repro case. |
@debora-ito , @dagnir , @zoewangg, @mtamassia I am facing same issue , I also suspect that there is possible memory leak in Connection Repeater. further drilling this heavy object i saw thousands of below instances, And here is path to GC root to those thousands of objects, My application is simple, it creates thread => create credential provide as shown in below code => Collect some data from cloudwatch using this credential provider => and then thread dies. Code to create credential provider :
Code in finally block of my application to close this provider:
I can easily reproduce this issue, As jprofiler is running live it clearly show memory ++ because of these objects. I am using below SDK version
Please let me know if you need any additional info. |
Hi @Dhananjay-Ghongane closing the credential provider itself does not close the stsClient. Line 83 in 3d2e2e5
So you need to close the stsClient too. The reason that the |
@zoewangg , |
@zoewangg I think what you posted above might resolve my issue too. Our code had an implicit credentials provider:
so based on your message above, we changed it to this:
In short, we are now closing the credentials provider. I have not tested this at scale but do you think that could explain the leak on our end? |
@mtamassia I don't think not closing Is it possible that some SDK client were not closed properly (failed to be closed silently) in your use case? Can you enable DEBUG log level to see if there were any error messages? It should be something like this:
|
Hi @zoewangg , I'm running into a similar issue. The only difference is that I am using the default credential provider chain, which in turn resolves to the StsWebIdentityCredentialsProvider. After a lot of debugging I figured out that closing the client does not close the STS client created by the StsWebIdentityCredentialsProvider when it is closed. TLDR; Long version; Would you like me to open a new issue? Stack dump from IntelliJ
|
We have an application that creates and destroys EC2, S3, and several other SDK clients.
We build clients within a thread and
close()
the clients within the thread. Example:Memory consumption grows over time and here is a link to the memory heap dump, which is self explicatory: https://heaphero.io/my-heap-report.jsp?p=YXJjaGl2ZWQvMjAyMC8wMy8yLy0tbWVtb3J5LnppcC0xOS01NC0zMi5qc29uLS0=
Expected Behavior
client
close()
should not be leaving resources behindCurrent Behavior
Threads and their associated data should be removed upon calling a client
close()
methodYour Environment
The text was updated successfully, but these errors were encountered: