u1backend crashes on SSLError (traceback)

Bug #894234 reported by Pi Delport
44
This bug affects 9 people
Affects Status Importance Assigned to Milestone
Duplicity
Confirmed
Undecided
Unassigned

Bug Description

Déjà Dup reported a Duplicity traceback (attached), while making a weekly scheduled backup to Ubuntu One.

Relevant bits of the traceback:

Traceback (most recent call last):
  [...]
  File "/usr/lib/python2.7/dist-packages/duplicity/backends/u1backend.py", line 214, in list
    answer = auth.request(remote_full)
  File "/usr/lib/python2.7/dist-packages/ubuntuone-couch/ubuntuone/couch/auth.py", line 147, in request
    url, method=http_method, headers=headers, body=request_body)
  File "/usr/lib/python2.7/dist-packages/httplib2/__init__.py", line 1436, in request
  [...]
  File "/usr/lib/python2.7/ssl.py", line 151, in read
    return self._sslobj.read(len)
SSLError: The read operation timed out

The root cause appears to be that various methods of U1Backend call ubuntuone.couch.auth.request(), but don't provide any handling of I/O errors raised by it.

I'm not really familiar with duplicity internals, but the auth.request() calls are followed by self.handle_error() calls that translates unsuccessful HTTP responses to BackendException (or TemporaryLoadException). Assuming BackendExceptions get reported more gracefully upstream, would it make sense to translate expected auth.request() errors to BackendException too? Or is there a better way to approach this?

Related bug reports:

https://bugs.launchpad.net/ubuntu/+source/deja-dup/+bug/844369
https://bugs.launchpad.net/ubuntu/+source/duplicity/+bug/885470 (This bug differs only in auth.request() raising socket.timeout, instead of ssl.SSLError.)

Relevant package versions:
deja-dup 20.1, duplicity 0.6.15, Python 2.7.2, Ubuntu 11.10 (oneiric)

Revision history for this message
Pi Delport (pi-delport) wrote :
Revision history for this message
Andreas Bennecke (ubuntu-ferret) wrote :

Could this be caused by a slow net connection in combination with the 10 second per megabyte timeout in auth.py?

Revision history for this message
Andreas Bennecke (ubuntu-ferret) wrote :

This is more of a patch to ubuntuone-couch but whoever wants to give this a try, here is a diff to auth.py:

*** auth.py.orig 2012-01-12 13:21:24.299384981 +0100
--- auth.py 2012-01-12 15:07:37.107246350 +0100
***************
*** 135,141 ****
          parameters[key] = value[0]

      request_len = len(request_body) if request_body else 0
! timeout = 10 * (request_len / 1024 / 1024 + 1) # 10 seconds per megabyte

      oauth_header = get_oauth_request_header(
          consumer, token, url, http_method, signature_method, parameters)
--- 135,142 ----
          parameters[key] = value[0]

      request_len = len(request_body) if request_body else 0
! timeout = 30 * (request_len / 1024 / 1024 + 1) # 30 seconds per megabyte
! if timeout > 600: timeout = 600 # max timeout 600 seconds

      oauth_header = get_oauth_request_header(
          consumer, token, url, http_method, signature_method, parameters)

papukaija (papukaija)
Changed in duplicity:
status: New → Confirmed
Revision history for this message
Tom Hughes (tomtheengineer) wrote :

The patch that Andreas posted fixes the issue for me. It would be great if it could be checked in.

Revision history for this message
papukaija (papukaija) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. This particular bug has already been reported and is a duplicate of bug 844369, so it is being marked as such. Please look at the other bug report to see if there is any missing information that you can provide, or to see if there is a workaround for the bug. Additionally, any further discussion regarding the bug should occur in the other report. Feel free to continue to report any other bugs you may find.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.