francoislaurent / escale

Escale - Client-to-client synchronization based on external relay storage
Other
3 stars 2 forks source link

504 gateway timeout errors on lock deletion #20

Closed francoislaurent closed 7 years ago

francoislaurent commented 7 years ago

WebDAV often suffers 504 errors when multiple writes are requested from various clients [v0.4]:

03/05 00:37 syncacre.*[CRITICAL]    manager.run:135 Traceback (most recent call last):
  File "syncacre/manager/manager.py", line 112, in run
    new |= self.download()
  File "syncacre/manager/manager.py", line 189, in download
    ok = self.relay.pop(remote_file, temp_file, blocking=False, **self.pop_args)
  File "syncacre/relay/relay.py", line 571, in pop
    self.releaseLock(remote_file)
  File "syncacre/relay/relay.py", line 469, in releaseLock
    self.unlink(self.lock(remote_file))
  File "syncacre/relay/webdav.py", line 319, in unlink
    self.webdav.delete(remote_file)
  File "/home/larva/.local/lib/python2.7/site-packages/easywebdav/client.py", line 150, in delete
    self._send('DELETE', path, 204)
  File "syncacre/relay/webdav.py", line 125, in _send
    raise e
OperationFailed: Failed to delete "remote.php/webdav/*/*/*/.*.lock".
  Operation     :  DELETE remote.php/webdav/*/*/*/*/.*.lock
  Expected code :  204 No Content
  Actual code   :  504 Gateway Timeout

As a consequence, locks are not removed but the corresponding files are successfully downloaded. Locks should be cleared on client restart and the affected files should be checked, at least by file size.

francoislaurent commented 7 years ago

This is one of the various error codes returned by the server when it cannot deal with multiple (especially write) requests at a time. This is similar to 500 errors. A 500 error was also observed on file deletion (not a lock nor a placeholder), for example.

These errors are not considered as critical for now, because the client do not abort. It sleeps instead, and then try again. Some operations may however be left incomplete and some repair strategies will have to be implemented.

The discussion about lock management is in issue #8.