-
Notifications
You must be signed in to change notification settings - Fork 910
StsWebIdentityCredentialsProvider memory leak #2149
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
Labels
bug
This issue is a bug.
Comments
Thank you for the detailed analysis! Sorry I didn't notice your comment in #1679. We will work on the fix |
|
aws-sdk-java-automation
added a commit
that referenced
this issue
Sep 20, 2022
…fd2a04ff1 Pull request: release <- staging/577a83d0-8752-42da-a7c7-e55fd2a04ff1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
StsWebIdentityCredentialsProvider in the default credential provider chain never gets closed. This causes a created STS client to never get closed, which in turn causes the IdleConnectionReaper to keep on to connection managers.
Expected Behavior
Default clients and credential provider chains should clean up any resources it created after being closed.
Current Behavior
DefaultCredentialsProvider#close
callsLazyAwsCredentialsProvider#close
, which callsIoUtils.closeIfCloseable
, but the provideddelegate
is not an AutoClosable type. It is actually aLazy<AwsCredentialsProvider>
, andLazy<T>
does not implement AutoClosable. So the chain (and consequently the STS client) in the delegate field never receives a close() call.Screenshot of the debugger

Stack dump from IntelliJ
Steps to Reproduce
I am running the following on a Kubernetes cluster with the AWS_ROLE_ARN and AWS_WEB_IDENTITY_TOKEN_FILE environment variables set. The memory just explodes, until eventually it goes out of memory.
Possible Solution
For example, let Lazy implement AutoClosable, and propage
close()
, like in IoUtils.Related Issues
I commented here, but its a closed issue and didn't get a response, so I'm opening this issue. #1679
Your Environment
The text was updated successfully, but these errors were encountered: