我有几个使用 boto 从 Amazon S3 读取许多文件的守护程序。每隔几天,我就会遇到从 boto 深处抛出 httplib.IncompleteRead 的情况。如果我尝试并重试该请求,它会立即因另一个 IncompleteRead 而失败。即使我打电话bucket.connection.close()
,所有进一步的请求仍然会出错。
我觉得我可能在这里偶然发现了 boto 中的一个错误,但似乎没有其他人遇到过它。难道我做错了什么?所有的守护进程都是单线程的,我尝试过is_secure
两种方式。
Traceback (most recent call last):
...
File "<file_wrapper.py",> line 22, in next
line = self.readline()
File "<file_wrapper.py",> line 37, in readline
data = self.fh.read(self.buffer_size)
File "<virtualenv/lib/python2.6/site-packages/boto/s3/key.py",> line 378, in read
self.close()
File "<virtualenv/lib/python2.6/site-packages/boto/s3/key.py",> line 349, in close
self.resp.read()
File "<virtualenv/lib/python2.6/site-packages/boto/connection.py",> line 411, in read
self._cached_response = httplib.HTTPResponse.read(self)
File "/usr/lib/python2.6/httplib.py", line 529, in read
s = self._safe_read(self.length)
File "/usr/lib/python2.6/httplib.py", line 621, in _safe_read
raise IncompleteRead(''.join(s), amt)
环境:
- 亚马逊 EC2
- Ubuntu 11.10
- Python 2.6.7
- 博托 2.12.0