Skip to content

HTTP and Swift transports should retry connection on failure #9

@alistairking

Description

@alistairking

Currently if the client reads data very slowly, the server may time out the connection, and we'll get an error like:

Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "build/bdist.linux-x86_64/egg/wandio/file.py", line 22, in next
  File "build/bdist.linux-x86_64/egg/wandio/compressed.py", line 68, in next
  File "build/bdist.linux-x86_64/egg/wandio/compressed.py", line 81, in readline
  File "build/bdist.linux-x86_64/egg/wandio/compressed.py", line 31, in _refill
  File "build/bdist.linux-x86_64/egg/wandio/file.py", line 25, in read
  File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 311, in read
    buf = self.resp.read(length)
  File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 463, in releasing_read
    chunk = self.resp.raw.read(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/urllib3/response.py", line 401, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python2.7/dist-packages/urllib3/response.py", line 320, in _error_catcher
    raise ProtocolError('Connection broken: %r' % e, e)
urllib3.exceptions.ProtocolError: ("Connection broken: error(104, 'Connection reset by peer')", error(104, 'Connection reset by peer'))

We should catch this and re-open the connection and then seek to the offset of the data previously consumed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions