No duplicate IdentityProperty names allowed - S3Client #3188
Unanswered
Gepporello
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I’m running an AWS Lambda written in Java 21 with Spring Boot 3. My Lambda uses an S3 client, which I instantiate as follows:
Problem:
When I invoke the Lambda multiple times in sequence, the AWS environment appears to create a new
S3Clientbefore the previous one is garbage collected. This leads to the following error:If I wait 5 to 7 minutes before rerunning the lambda, everything works perfectly fine, but it's obviously not acceptable.
From debugging, I see this comes from the AWS SDK’s
IdentityPropertyclass, specifically:It seems that after the first Lambda invocation,
NAME_HISTORYis not cleared, so subsequent invocations fail when trying to register the same"java.lang.String"/"Bucket"key.This method is called by
S3ExpressAuthSchemeProvider, which is in turn called byDefaultS3ClientBuilder.What I’ve tried:
S3Clientas a static class variable@Scope("prototype")for the beanNAME_HISTORYmap via reflection (which just led to a similar error for another property)Question:
Beta Was this translation helpful? Give feedback.
All reactions