Closed BartXZX closed 3 years ago
Thank you for the detailed analysis! Sorry I didn't notice your comment in #1679. We will work on the fix
Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
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. https://github.com/aws/aws-sdk-java-v2/issues/1679
Your Environment