Skip to content

Commit

Permalink
Merge pull request #301 from apmorton/am/fix-urllib3-incomplete-download
Browse files Browse the repository at this point in the history
Fix retrying incomplete downloads with urllib3 2.x
  • Loading branch information
nateprewitt committed Mar 14, 2024
2 parents dad5c83 + d57aff5 commit 1751c65
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changes/next-release/bugfix-urllib3-70927.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "bugfix",
"category": "``urllib3``",
"description": "Fixed retry handling for IncompleteRead exception raised by urllib3 2.x during data transfer"
}
4 changes: 3 additions & 1 deletion s3transfer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def __call__(self, bytes_amount):
import threading

from botocore.compat import six # noqa: F401
from botocore.exceptions import IncompleteReadError
from botocore.exceptions import IncompleteReadError, ResponseStreamingError
from botocore.vendored.requests.packages.urllib3.exceptions import (
ReadTimeoutError,
)
Expand Down Expand Up @@ -624,6 +624,7 @@ def _download_range(
OSError,
ReadTimeoutError,
IncompleteReadError,
ResponseStreamingError,
) as e:
logger.debug(
"Retrying exception caught (%s), "
Expand Down Expand Up @@ -840,6 +841,7 @@ def _get_object(self, bucket, key, filename, extra_args, callback):
OSError,
ReadTimeoutError,
IncompleteReadError,
ResponseStreamingError,
) as e:
# TODO: we need a way to reset the callback if the
# download failed.
Expand Down
7 changes: 6 additions & 1 deletion s3transfer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
import threading
from collections import defaultdict

from botocore.exceptions import IncompleteReadError, ReadTimeoutError
from botocore.exceptions import (
IncompleteReadError,
ReadTimeoutError,
ResponseStreamingError,
)
from botocore.httpchecksum import AwsChunkedWrapper
from botocore.utils import is_s3express_bucket

Expand All @@ -41,6 +45,7 @@
SOCKET_ERROR,
ReadTimeoutError,
IncompleteReadError,
ResponseStreamingError,
)


Expand Down

0 comments on commit 1751c65

Please sign in to comment.