boto key.get_contents_to_filename and set_contents_from_filename throws socket.error and httplib.Incompleteread
Author: rpatleCreated Feb 7, 2016Updated Sep 13, 2023
I have written a module using boto (version - 2.38.0, Python 2.6.6, CentOS) to upload and download bug size file (>100MB). Occasionally i am facing either of two issue.
- socket.error.
- httplib.Incompleteread Even after retry the same operation error persist. The only difference with first error is that after retry it convert into second one. sample code :
@retry_decorator
def _get_data_to_file(self, src_key_object, file_name):
try:
s_key.get_contents_to_filename(file_name)
except Exception, fault:
logger_obj.traceback(fault)
raiseretry_decorator is external module written for retry. It tries to re-execute the same function till the retry limit exceeded. trace-back:
[2016-02-02 10:23:09,427] [ERROR] Error <class 'socket.error'>:[Errno 104] Connection reset by peer. Traceback -Traceback (most recent call last):
File "roboClientLib/boto/awsDRLib.py", line 1173, in _get_data_to_file
File "boto/s3/key.py", line 1712, in get_contents_to_filename
File "boto/s3/key.py", line 1650, in get_contents_to_file
File "boto/s3/key.py", line 1482, in get_file
File "boto/s3/key.py", line 1535, in _get_file_internal
File "boto/s3/key.py", line 386, in next
File "boto/connection.py", line 413, in read
File "httplib.py", line 542, in read
File "socket.py", line 377, in read
File "ssl.py", line 215, in recv
File "ssl.py", line 136, in read
error: [Errno 104] Connection reset by peer
[2016-02-02 10:23:39,459] [ERROR] Error <class 'httplib.IncompleteRead'>:IncompleteRead(0 bytes read, 112795648 more expected). Traceback -Traceback (most recent call last):
File "roboClientLib/boto/awsDRLib.py", line 1173, in _get_data_to_file
File "boto/s3/key.py", line 1712, in get_contents_to_filename
File "boto/s3/key.py", line 1650, in get_contents_to_file
File "boto/s3/key.py", line 1482, in get_file
File "boto/s3/key.py", line 1535, in _get_file_internal
File "boto/s3/key.py", line 388, in next
File "boto/s3/key.py", line 370, in close
File "boto/connection.py", line 410, in read
File "httplib.py", line 529, in read
File "httplib.py", line 621, in _safe_read
IncompleteRead: IncompleteRead(0 bytes read, 112795648 more expected)Source: boto/boto