Skip to content

Commit a674322

Browse files
committed
fix deadlock in nonblocking semaphore acquiring, do inner lock release for every lock acquiring attempt
1 parent 4df0011 commit a674322

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kazoo/recipe/lock.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,10 +472,10 @@ def _inner_acquire(self, blocking, timeout=None):
472472
w = _Watch(duration=timeout)
473473
w.start()
474474
lock = self.client.Lock(self.lock_path, self.data)
475-
gotten = lock.acquire(blocking=blocking, timeout=w.leftover())
476-
if not gotten:
477-
return False
478475
try:
476+
gotten = lock.acquire(blocking=blocking, timeout=w.leftover())
477+
if not gotten:
478+
return False
479479
while True:
480480
self.wake_event.clear()
481481

0 commit comments

Comments
 (0)