Blocking call to acquire an already acquired lock fails
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
tooz |
Fix Released
|
Undecided
|
Imran Ansari |
Bug Description
Description:
============
For Etcd3Lock, blocking call to acquire an already acquired lock fails when the thread/process, that acquired the lock takes more than the timeout specified for the lock.
Scenario:
=========
1. First thread acquires a lock "Lock1"
2. Second thread tries to acquire "Lock1" with blocking=True
3. First thread releases lock after few minutes
4. Second thread tries to acquire it and fails with exception:
ToozError: Not found
Cause:
======
Lease gets created when the lock is created and the default timeout is 30 secs.
Since the first thread takes more than 30 seconds to complete, the lease for the second thread gets expired leading to "Not found" message.
Fix:
====
Create lease within Etcd3Lock.acquire() rather than Etcd3Lock.
Changed in python-tooz: | |
assignee: | nobody → Imran Ansari (imran.ansari) |
Fix proposed to branch: master /review. openstack. org/491354
Review: https:/