summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2014-07-23 10:49:44 -0300
committerdrebs <drebs@leap.se>2014-08-08 11:49:02 -0300
commit609669077b2f7223c31feed3679c8fcd74ab9ba7 (patch)
treee297be4217366231f4ccb746798033104517ed53
parent8afb79c4d2171b03270143639296cbb6d9d0fdfa (diff)
Avoid deadlocks when cancelling failed sync threads.
-rw-r--r--client/src/leap/soledad/client/target.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/client/src/leap/soledad/client/target.py b/client/src/leap/soledad/client/target.py
index 032134ec..5fe55216 100644
--- a/client/src/leap/soledad/client/target.py
+++ b/client/src/leap/soledad/client/target.py
@@ -376,6 +376,12 @@ class DocumentSyncerPool(object):
t.request_lock.release()
t.callback_lock.acquire(False) # just in case
t.callback_lock.release()
+ # release any blocking semaphores
+ for i in xrange(DocumentSyncerPool.POOL_SIZE):
+ try:
+ self._semaphore_pool.release()
+ except ValueError:
+ break
logger.warning("Soledad sync: cancelled sync threads.")
def cleanup(self):