-
Notifications
You must be signed in to change notification settings - Fork 39
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
AwsEventLoop threads still exist after closing CRT client #856
Comments
With that said, these are green threads and should not take much memory/cpu when idle. |
There is no way to pass an I have profiled these threads in my beta service. They are wasting cpu cycles (they have 2k samples out of 300k samples total) and they are causing a memory leak in my service (I can find |
If the event loop has nothing to do then it will sleep for upwards of 100 seconds: https://github.com/awslabs/aws-c-io/blob/main/source/linux/epoll_event_loop.c#L563 If you are seeing non-trivial amounts of CPU time spent in an event loop thread then it still has work to do. Closing a client is not synchronous. Close merely indicates that you're done with the client. There is a lot of work that needs to happen to shut down and clean up the client and it will take "awhile" (usually some reasonable fraction of a second) especially if there are open network connections. My guess is that your sampling interval is catching part of shutdown. Beyond that, memstore perf events are not evidence of a memory leak. The loop is still active and tracking internal statistics even if 99.99+% of the time it is asleep: https://github.com/awslabs/aws-c-io/blob/main/source/linux/epoll_event_loop.c#L610-L700 |
Agreed. I did not find any minor page fault events coming from it. I had a bug in my code earlier (now changed) that would instantiate 4 clients on startup, and this did exhibit growing anon memory usage over time (~2GB p/day) despite only being used on startup. I have since changed it to 1 client on startup and do not find this behavior. @bretambrose do you have any idea what that may have been? The ticket can be resolved independent of this question. |
Describe the bug
After closing my async CRT client, I still have
AwsEventLoop
threads running in my process. These threads are consuming CPU and leaking memory.Regression Issue
Expected Behavior
I expect all threads created by the CRT client to be destroyed when I call
close()
.Current Behavior
Below is an example
After the upload completes & the s3 client is closed, I can still see the
AwsEventLoop
threads running:Reproduction Steps
I shared example snippet in Current Behavior section.
Possible Solution
No response
Additional Information/Context
No response
aws-crt-java version used
v0.31.1
Java version used
JDK 17
Operating System and version
Linux version 5.10.230-202.885.amzn2int.x86_64 (mockbuild@ip-10-0-46-226) (gcc10-gcc (GCC) 10.2.1 20210130 (Red Hat 10.2.1-11)
The text was updated successfully, but these errors were encountered: