RedisDriver _stop() method doesn't release locks

Bug #1815330 reported by Bob Haddleton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tooz
Fix Released
Undecided
Stephen Finucane

Bug Description

The RedisDriver _stop() method doesn't release locks because it pop()s them out of the _acquired_locks set before calling lock.release(), and the RedisLock release() method returns False without releasing the lock if it doesn't find the lock in the coordinator's _acquired_locks set.

    def _stop(self):
        while self._acquired_locks:
            lock = self._acquired_locks.pop()
            try:
                lock.release()

RedisLock():
    def release(self):
        with self._exclusive_access:
            if not self.acquired:
                return False
            with _translate_failures():
                try:
                    self._lock.release()

Since the lock has been popped out of the set, it is never released and eventually times out.

This delays the election of a new leader for the group until the lock times out.

Changed in python-tooz:
assignee: nobody → Bob Haddleton (bob-haddleton)
status: New → In Progress
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/636038

Changed in python-tooz:
assignee: Bob Haddleton (bob-haddleton) → Stephen Finucane (stephenfinucane)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tooz (master)

Reviewed: https://review.opendev.org/636038
Committed: https://git.openstack.org/cgit/openstack/tooz/commit/?id=842c7404b2d01c5dd718c14bb55f0cd47471f0e1
Submitter: Zuul
Branch: master

commit 842c7404b2d01c5dd718c14bb55f0cd47471f0e1
Author: Bob.Haddleton <email address hidden>
Date: Sat Feb 9 21:24:54 2019 -0600

    RedisLock release() should not check if the lock has been acquired

    The RedisDriver coordinator _stop() method removes the lock from the
    _acquired_locks set before calling the release() method on the lock,
    so the release() method should not check to see if the lock is in the
    set, since it never will be.

    This was preventing the coordinator's _stop() method from releasing
    the locks, so they had to timeout before another group member could
    take over as leader.

    Change-Id: Ie23d88f1a05983d7465f18a329cabc23d789a628
    Closes-Bug: 1815330

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.67.2

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tooz (stable/train)

Fix proposed to branch: stable/train
Review: https://review.opendev.org/c/openstack/tooz/+/848653

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tooz (stable/train)

Reviewed: https://review.opendev.org/c/openstack/tooz/+/848653
Committed: https://opendev.org/openstack/tooz/commit/85d0a8b2e09e37639ad29bb3bbcbbad55719dd8e
Submitter: "Zuul (22348)"
Branch: stable/train

commit 85d0a8b2e09e37639ad29bb3bbcbbad55719dd8e
Author: Bob.Haddleton <email address hidden>
Date: Sat Feb 9 21:24:54 2019 -0600

    RedisLock release() should not check if the lock has been acquired

    The RedisDriver coordinator _stop() method removes the lock from the
    _acquired_locks set before calling the release() method on the lock,
    so the release() method should not check to see if the lock is in the
    set, since it never will be.

    This was preventing the coordinator's _stop() method from releasing
    the locks, so they had to timeout before another group member could
    take over as leader.

    Change-Id: Ie23d88f1a05983d7465f18a329cabc23d789a628
    Closes-Bug: 1815330
    (cherry picked from commit 842c7404b2d01c5dd718c14bb55f0cd47471f0e1)

tags: added: in-stable-train
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tooz train-eol

This issue was fixed in the openstack/tooz train-eol 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.