diff --git a/.changes/next-release/bugfix-urllib3-70927.json b/.changes/next-release/bugfix-urllib3-70927.json new file mode 100644 index 00000000..96ef2e90 --- /dev/null +++ b/.changes/next-release/bugfix-urllib3-70927.json @@ -0,0 +1,5 @@ +{ + "type": "bugfix", + "category": "``urllib3``", + "description": "Fixed retry handling for IncompleteRead exception raised by urllib3 2.x during data transfer" +} diff --git a/s3transfer/__init__.py b/s3transfer/__init__.py index d2a71911..b4137de5 100644 --- a/s3transfer/__init__.py +++ b/s3transfer/__init__.py @@ -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, ) @@ -624,6 +624,7 @@ def _download_range( OSError, ReadTimeoutError, IncompleteReadError, + ResponseStreamingError, ) as e: logger.debug( "Retrying exception caught (%s), " @@ -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. diff --git a/s3transfer/utils.py b/s3transfer/utils.py index 9954dc0a..ef171f54 100644 --- a/s3transfer/utils.py +++ b/s3transfer/utils.py @@ -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 @@ -41,6 +45,7 @@ SOCKET_ERROR, ReadTimeoutError, IncompleteReadError, + ResponseStreamingError, )