-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
S3 download_file does not retry on ConnectionErrors when receiving response #3876
Comments
Hi @adrianliaw thanks for reaching out. I brought this issue up for discussion with the team, and they may be open to considering the changes you suggested. However, they would first like to gather more information to support the points shared here. Can you provide logs that demonstrate the issue you are describing? (You can get the full logs |
@tim-finnigan here's the logs (and also the script content, taken out from unit test content): https://gist.github.com/adrianliaw/ca8a36eea127ea7e49ffcad4fbf07e48 |
Thanks @adrianliaw for following up. I can reproduce the issue with the sample you provided. I'll leave this issue open for tracking and others are welcome to 👍 the issue and share their thoughts here in the comments. |
Hey @tim-finnigan iis this issue up fpr grabs? If not can you assign me this , I would love to work on it. |
boto/s3transfer#301 |
Describe the bug
When there's a
ConnectionError
during reading S3 get object response (perhaps because of network issues), boto3/s3transfer does not retry these requests and raisesResponseStreamingError
immediately. We occasionally getConnectionResetError
s from S3, which I'd assume would be retried based on boto3 docs about retries, becauseConnectionResetError
is a subclass ofConnectionError
.Expected Behavior
download_file
should have automatic retries forConnectionError
s if boto3 client has a retry strategy configured.Current Behavior
If a
ConnectionError
happens during reading of response body duringdownload_file
, the entiredownload_file
operation is failed withResponseStreamingError
without retries.Reproduction Steps
I used the following unit test (note that this test is not hermetic as it actually uses boto3) to demonstrate that downloading is not retried, substituting
<a bucket that actually exists>
and<a key that actually exists>
with actual bucket/key that I have:Possible Solution
Consider adding
ResponseStreamingError
toS3_RETRYABLE_DOWNLOAD_ERRORS
list.I think retrying this kind of network connection issues is suitable for download operation as these HEAD/GET requests should be idempotent.
Additional Information/Context
I confirmed that
ConnectionResetError
s are not retried by walking through these breadcrumbs:ProtocolError
when there's aConnectionError
(which is a subclass ofOSError
)StreamingBody.read()
raisesResponseStreamingError
(the error we got) when a urllib3ProtocolError
is caughtDownloadChunkIterator
for multi-part downloadsS3_RETRYABLE_DOWNLOAD_ERRORS
, which includessocket.timeout
,ConnectionError
,ReadTimeoutError
/IncompleteReadTimeout
defined inbotocore
ResponseStreamingError
(ResponseStreamingError
->HTTPClientError
->BotoCoreError
->Exception
)My understanding is s3transfer "tries" to catch and retry
ConnectionError
(and other retryable errors), but urllib3 masksConnectionError
asProtocolError
, then s3transfer masksProtocolError
asResponseStreamingError
, which botocore also catches but errors out instead of retrying.SDK version used
1.28.54
Environment details (OS name and version, etc.)
Amazon Linux 2
The text was updated successfully, but these errors were encountered: