Blocking call to acquire an already acquired lock fails

Bug #1708836 reported by Imran Ansari
6
This bug affects 1 person
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.__init__() of Etcd3Lock

Changed in python-tooz:
assignee: nobody → Imran Ansari (imran.ansari)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tooz (master)

Fix proposed to branch: master
Review: https://review.openstack.org/491354

Changed in python-tooz:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tooz (master)

Reviewed: https://review.openstack.org/491354
Committed: https://git.openstack.org/cgit/openstack/tooz/commit/?id=a333c7906621ebd609fa2c56d6ca1691f47eba04
Submitter: Jenkins
Branch: master

commit a333c7906621ebd609fa2c56d6ca1691f47eba04
Author: Imran Ansari <email address hidden>
Date: Fri Jul 28 21:09:02 2017 +0000

    Acquire fails with "ToozError: Not found"

    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.

    Resolution
    ==========
    Create lease within Etcd3Lock.acquire() rather than
    Etcd3Lock.__init__() of Etcd3Lock

    Change-Id: Ief75675ebde2d824a25aec6210e2a868cf3dbbe7
    Closes-Bug: #1708836

Changed in python-tooz:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tooz 1.59.0

This issue was fixed in the openstack/tooz 1.59.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.