From 534263b3e02a5f77d820ec38b0369ac1c4ff6c51 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Fri, 2 Oct 2015 12:03:29 -0400 Subject: [bug] do not signal sync completion if failed - Related: #7503 --- client/changes/bug_7503-do-not-signal-sync-complete | 1 + client/src/leap/soledad/client/api.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 client/changes/bug_7503-do-not-signal-sync-complete (limited to 'client') diff --git a/client/changes/bug_7503-do-not-signal-sync-complete b/client/changes/bug_7503-do-not-signal-sync-complete new file mode 100644 index 00000000..4cc361e0 --- /dev/null +++ b/client/changes/bug_7503-do-not-signal-sync-complete @@ -0,0 +1 @@ +o Do not signal sync completion if sync failed. Closes: #7503 diff --git a/client/src/leap/soledad/client/api.py b/client/src/leap/soledad/client/api.py index a558addd..8c5f7f1b 100644 --- a/client/src/leap/soledad/client/api.py +++ b/client/src/leap/soledad/client/api.py @@ -723,7 +723,7 @@ class Soledad(object): return passthrough d.addCallbacks(_sync_callback, _sync_errback) - d.addBoth(_emit_done_data_sync) + d.addCallback(_emit_done_data_sync) return d @property -- cgit v1.2.3 From ba203923cd2479fafe662c8edae56763d8babb67 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Fri, 2 Oct 2015 11:54:54 -0400 Subject: [bug] increase http request timeout time to 90s this is a workaroud to reduce the chances of failed sync due to timeouts. this should be properly tackled by: 1. implementing proper cancellable for the sync operation. 2. implementing a retry count at the level of a single request, handled internally by soledad. in this way we can remove the retries logic from the soledadbootstrapper in the bitmask client. - Related: #7382 --- client/src/leap/soledad/client/http_target/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'client') diff --git a/client/src/leap/soledad/client/http_target/__init__.py b/client/src/leap/soledad/client/http_target/__init__.py index 7a5cea9f..498fb6e7 100644 --- a/client/src/leap/soledad/client/http_target/__init__.py +++ b/client/src/leap/soledad/client/http_target/__init__.py @@ -87,4 +87,8 @@ class SoledadHTTPSyncTarget(SyncTargetAPI, HTTPDocSender, HTTPDocFetcher): # asynchronous encryption/decryption attributes self._decryption_callback = None self._sync_decr_pool = None - self._http = HTTPClient(cert_file) + + # XXX Increasing timeout of simple requests to avoid chances of hitting + # the duplicated syncing bug. This could be reduced to the 30s default + # after implementing Cancellable Sync. See #7382 + self._http = HTTPClient(cert_file, timeout=90) -- cgit v1.2.3 From a1906cf4e808ddf64b6117334112ada830e5eb1a Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Sat, 19 Sep 2015 14:25:30 -0300 Subject: [feat] handle DatabaseDoesNotExist during sync This error raises while getting info on target (or server) replica. On previous implementation there was nothing to do here, but now that we have db creation in place this error should be handled just like u1db original implementation. The reason is that db creation occurs during sync exchange, but before this we try to ask for info and the code that checks for info raises an error that will be used to signal the client that a database will be created and that it must save the replica uid returned by server, after sync exchange (where we send/fetch documents). --- client/src/leap/soledad/client/sync.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'client') diff --git a/client/src/leap/soledad/client/sync.py b/client/src/leap/soledad/client/sync.py index 110baa0a..225d3e2d 100644 --- a/client/src/leap/soledad/client/sync.py +++ b/client/src/leap/soledad/client/sync.py @@ -69,9 +69,15 @@ class SoledadSynchronizer(Synchronizer): # get target identifier, its current generation, # and its last-seen database generation for this source ensure_callback = None - (self.target_replica_uid, target_gen, target_trans_id, - target_my_gen, target_my_trans_id) = yield \ - sync_target.get_sync_info(self.source._replica_uid) + try: + (self.target_replica_uid, target_gen, target_trans_id, + target_my_gen, target_my_trans_id) = yield \ + sync_target.get_sync_info(self.source._replica_uid) + except errors.DatabaseDoesNotExist: + logger.debug("Database isn't ready on server. Will be created.") + self.target_replica_uid = None + target_gen, target_trans_id = 0, '' + target_my_gen, target_my_trans_id = 0, '' logger.debug( "Soledad target sync info:\n" -- cgit v1.2.3 From 60cb0fe4eb18669a0b4b213d74c11b2ff60118a1 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Mon, 5 Oct 2015 18:09:34 -0300 Subject: [bug] handle MissingDesignDocError after get_sync_info MissingDesignDocError raised on get_sync_info due to a missing design document will be handled by the server during sync. Ensure is now False by default, and thus database creation can deliver an empty one that will be ensured during sync, following the ensure parameter. --- client/changes/bug_missing_design_doc_handler | 1 + client/src/leap/soledad/client/sync.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 client/changes/bug_missing_design_doc_handler (limited to 'client') diff --git a/client/changes/bug_missing_design_doc_handler b/client/changes/bug_missing_design_doc_handler new file mode 100644 index 00000000..72e42b85 --- /dev/null +++ b/client/changes/bug_missing_design_doc_handler @@ -0,0 +1 @@ +o Handle missing design doc at GET (get_sync_info). Soledad server can handle this during sync. diff --git a/client/src/leap/soledad/client/sync.py b/client/src/leap/soledad/client/sync.py index 225d3e2d..2276db2a 100644 --- a/client/src/leap/soledad/client/sync.py +++ b/client/src/leap/soledad/client/sync.py @@ -22,6 +22,7 @@ import logging from twisted.internet import defer from u1db import errors +from leap.soledad.common.errors import MissingDesignDocError from u1db.sync import Synchronizer @@ -73,8 +74,9 @@ class SoledadSynchronizer(Synchronizer): (self.target_replica_uid, target_gen, target_trans_id, target_my_gen, target_my_trans_id) = yield \ sync_target.get_sync_info(self.source._replica_uid) - except errors.DatabaseDoesNotExist: + except (errors.DatabaseDoesNotExist, MissingDesignDocError) as e: logger.debug("Database isn't ready on server. Will be created.") + logger.debug("Reason: %s", e.__class__) self.target_replica_uid = None target_gen, target_trans_id = 0, '' target_my_gen, target_my_trans_id = 0, '' -- cgit v1.2.3 From 2c5c7f58b796fc9f71c4279a2d3f5fa062ef2533 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Tue, 27 Oct 2015 18:46:29 -0300 Subject: [pkg] fold in changes --- client/changes/bug_7503-do-not-signal-sync-complete | 1 - client/changes/bug_missing_design_doc_handler | 1 - 2 files changed, 2 deletions(-) delete mode 100644 client/changes/bug_7503-do-not-signal-sync-complete delete mode 100644 client/changes/bug_missing_design_doc_handler (limited to 'client') diff --git a/client/changes/bug_7503-do-not-signal-sync-complete b/client/changes/bug_7503-do-not-signal-sync-complete deleted file mode 100644 index 4cc361e0..00000000 --- a/client/changes/bug_7503-do-not-signal-sync-complete +++ /dev/null @@ -1 +0,0 @@ -o Do not signal sync completion if sync failed. Closes: #7503 diff --git a/client/changes/bug_missing_design_doc_handler b/client/changes/bug_missing_design_doc_handler deleted file mode 100644 index 72e42b85..00000000 --- a/client/changes/bug_missing_design_doc_handler +++ /dev/null @@ -1 +0,0 @@ -o Handle missing design doc at GET (get_sync_info). Soledad server can handle this during sync. -- cgit v1.2.3