botocore: Is adaptive retry meant to catch 429 Too Many Requests errors?
Describe the bug
We have a client configured with retries={"mode": "adaptive", "max_attempts": 10}
In some situations we are seeing the following response:
DEBUG botocore.retries.standard (standard.py:90) - Not retrying request.
<stack trace>
botocore.exceptions.ClientError: An error occurred (429) when calling the GetObject operation: Too Many Requests
The implication is that for standard retries http error 429 (Too Many Requests) is not handled. Am I reading things correctly? Am I meant to do backoff retry myself?
botocore/data/_retry.json does list 429:
"too_many_requests": {
"applies_when": {
"response": {
"http_status_code": 429
}
}
},
but does that not apply to adaptive retries?
Sorry if I’ve missed some documentation.
Expected behavior
Sorry if I’ve missed some documentation. Is there some configuration I’m meant to set to enable retries? 429 Too Many Requests seems like it’s something that should be handled automatically by the retry infrastructure.
Debug logs
I enabled debug logging and it reports “Not retrying request”.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (5 by maintainers)
I fully agree with @timj and this should have been an easy fix. Sad for interop and software quality that it wasn’t.
I am using botocore in some code that connects directly to the bucket. Lambda is not involved.
I do not understand why you can’t add 429 to the retry list explicitly. It won’t harm anyone and will help Google users. Given the conversation on this ticket I have to abandon using botocore on Google and am rewriting my client to use google-cloud-storage APIs directly.
The code uses
download_fileobj: https://github.com/lsst/resources/blob/main/python/lsst/resources/s3.py#L213-L215I think you are saying that a general http error code of 429 is not handled by the new retry code because 429 is not listed by the AWS error codes. Maybe the Google implementation of AWS is not fully compliant with the Amazon one? Would it be possible to add 429 to the list of standard retry codes? 429 clearly implies a retry is desirable (I do not know if a
retry-afterheader is included in the response from Google).