-
Notifications
You must be signed in to change notification settings - Fork 863
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
Add stale time config to InstanceProfileCredentialsProvider #5758
base: master
Are you sure you want to change the base?
Conversation
…for refreshing credentials earlier due to stale value. This will help prevent returning invalid credentials when an error is encountered during asynchronous refresh.
…for refreshing credentials earlier due to stale value. This will help prevent returning invalid credentials when an error is encountered during asynchronous refresh.
...n/java/software/amazon/awssdk/auth/credentials/internal/StaticResourcesEndpointProvider.java
Outdated
Show resolved
Hide resolved
...rc/main/java/software/amazon/awssdk/auth/credentials/InstanceProfileCredentialsProvider.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to change that default to be > 10s; without that any 503 response is not going be recovered from.
Those of us who have encountered the problem will know to explicitly change it, but people who haven't yet hit it will only find out when things go wrong.
There is also the subtlety that all processes running in the same VM will be using the same timeout, as it is based on when the shared credentials expire. The more processes running, the more risk of that 503 -regardless of what the value is. This means that any constant value can create a Thundering Herd.
The "extra load" concern is marginal, given refresh time is every hour. spreading out that load is likely to be better as any herd-triggered retry is load in itself.
I'd suggest some larger number and maybe a jitter of a few seconds to spread out load from many processes.
...rc/main/java/software/amazon/awssdk/auth/credentials/InstanceProfileCredentialsProvider.java
Show resolved
Hide resolved
There is already jitter, up to 1 minute before expiration time. Also, I am weary of changing default values, it may cause unexpected behaviour change in user applications and we try to avoid those. Is the ability to configure the value manually on the builder yourself not a viable solution for your use case? |
I'm happy with the change -but do think you should consider documenting this for others |
…h' into olapplin/instance-profile-refresh
Good point, I added a note about the issue in the javadoc for |
Quality Gate failedFailed conditions |
Add stale time config to
InstanceProfileCredentialsProvider
to allow for refreshing credentials earlier due to stale value. This will help prevent returning invalid credentials when an error is encountered during asynchronous refresh.Motivation and Context
Fixes for #5247 , this will allow user to provide a higher value for prefetch to prevent returning expired credentails without changing default value. Increasing this value may lead to a higher rate of request to IMDS, so we ought to avoid changing the base default value for it.
Modifications
staleTime
configuration option toInstanceProfileCredentialsProvider
InstanceProfileCredentialsProvider
Testing
Added unit tests
Screenshots (if appropriate)
Types of changes