aws-c-s3: Please consider retrying ExpiredToken
Describe the feature
Add ExpiredToken to the list of retryable errors.
Use Case
When processing is slow, it is possible to overrun the time budget of an STS token (usually 1 hour).
The STS tokens are refreshed only when a new request is made, or a request is retried.
This is by virtue of calling the delegated STS token provider, which does a RefreshIfExpired.
Under healthy conditions, retrying a request with an expired refreshable token has a likelihood to succeed on retry. In the worst case there are a number of useless retries, which seems worth the expense.
Proposed Solution
We have seen ExpiredToken under conditions similar to RequestTimeout (#457) and so propose adding ExpiredToken to the list of retryable exceptions.
Why this would work
The STS tokens are refreshed each time .sign_request = aws_s3_meta_request_sign_request_default is called, by virtue of aws_sign_request_aws, which calls aws_credentials_provider_get_credentials on the (STS) credential provider delegated from the C++ SDK to the C libraries.
- On retry,
s_s3_client_retry_readyis called (but only ifAWS_S3_CONNECTION_FINISH_CODE_RETRYis set). - This calls
aws_s3_meta_request_prepare_request, which callss_s3_meta_request_schedule_prepare_request_default, - which schedules
s_s3_meta_request_prepare_request_task, which callss_s3_meta_request_on_request_prepared, - which calls
s_s3_meta_request_sign_request, which callsaws_s3_meta_request_sign_request_default, - which calls
aws_sign_request_aws, - which then refreshes the credentials (part of what the STS token provider does when
GetCredentials()is called).
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 22 (21 by maintainers)
Commits related to this issue
- [s3_meta_request]: Retry on ExpiredToken Similar to the case of `RequestTimeout`, when progress stalls due to a prolonged time of the server closing connections and similar conditions that prevent re... — committed to grrtrr/aws-c-s3 by grrtrr 2 years ago
- [STS Credentials Provider]: update grace period from 5 sec to 5 min A grace period of 5 seconds is too low: - Recommended [guidance](https://repost.aws/questions/QUgE4lrlyBSimJZTpIO9o7Hw/the-provided... — committed to grrtrr/aws-sdk-cpp by grrtrr 2 years ago
- [STS Credentials Provider]: update grace period from 5 sec to 5 min A grace period of 5 seconds is too low: - Recommended [guidance](https://repost.aws/questions/QUgE4lrlyBSimJZTpIO9o7Hw/the-provided... — committed to grrtrr/aws-sdk-cpp by grrtrr 2 years ago
- [STS Credentials Provider]: update grace period from 5 sec to 5 min A grace period of 5 seconds is too low: - Recommended [guidance](https://repost.aws/questions/QUgE4lrlyBSimJZTpIO9o7Hw/the-provided... — committed to aws/aws-sdk-cpp by grrtrr 2 years ago
I have released https://github.com/awslabs/aws-c-s3/releases/tag/v0.7.18 which reverts the retry token PR.
Thank you @waahm7 - put up https://github.com/aws/aws-sdk-cpp/pull/3415 for the second one (which mimics https://github.com/awslabs/aws-c-auth/pull/247).
Thank you for the PR. It has been released in https://github.com/awslabs/aws-c-s3/releases/tag/v0.7.7. We have also backlogged the task to move signing closer to the actual HTTP request to mitigate this issue further.