boto key.get_content抛出socket.error然后重试失败

时间:2016-02-02 17:48:38

标签: python amazon-s3 boto httplib

我正在使用boto从S3存储桶上传和下载数据。我首先检查密钥存在,然后按如下方式调用下载到boto文件api。

    @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.traceback(fault)
        raise

retry_decorator是装饰器函数,有助于在调用失败时重试操作。我在追溯中发现了以下错误。

[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)

并继续进行类似的错误重试。我观察到的是第一次回溯显示套接字错误,而后续追踪相同的调用显示其他东西..

任何人都可以帮助理解为什么我可以在重试后执行调用..?

0 个答案:

没有答案