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_ready is called (but only if AWS_S3_CONNECTION_FINISH_CODE_RETRY is set).
  • This calls aws_s3_meta_request_prepare_request, which calls s_s3_meta_request_schedule_prepare_request_default,
  • which schedules s_s3_meta_request_prepare_request_task, which calls s_s3_meta_request_on_request_prepared,
  • which calls s_s3_meta_request_sign_request, which calls aws_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

Most upvoted comments

I have released https://github.com/awslabs/aws-c-s3/releases/tag/v0.7.18 which reverts the retry token PR.

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.