commit 1b5b21e7c01998bbb972920ec869e51d1c20f105
Author: Julien Danjou <email address hidden>
Date: Sat Mar 18 10:33:57 2017 +0100
redis: fix concurrent access on acquire()
Redis-py is not thread safe and in lock management, which means the following
can also happen:
1. lock.acquire()
2a. lock.release() ---\_ at the same time for all 2. operations
2b. lock.acquire() ---/
2c. lock.heartbeat() /
which means the lock can be when a lock is already acquired and in the process
of being released and re-acquired in paralllel:
1. acquire() acquire the lock (self._lock.acquire())
2. release() release the lock (self._lock.release()) and remove it from self._lock.acquire() where it's not (discard() does not raise on non-existing
element)
3. acquire() put the lock in _acquired_locks
4. heartbeat() iterates on _acquired_locks and try to extend a lock that indeed
was acquired but was in the mean time released by Redis.
Change-Id: Ib9549b44485cb15de312ec9dfa57b148cb45e2c9
Closes-Bug: #1557593
(cherry picked from commit 059f2ae5406a325017ad181ace1e5b7c5bff0d22)
Reviewed: https:/ /review. openstack. org/478131 /git.openstack. org/cgit/ openstack/ tooz/commit/ ?id=1b5b21e7c01 998bbb972920ec8 69e51d1c20f105
Committed: https:/
Submitter: Jenkins
Branch: stable/newton
commit 1b5b21e7c01998b bb972920ec869e5 1d1c20f105
Author: Julien Danjou <email address hidden>
Date: Sat Mar 18 10:33:57 2017 +0100
redis: fix concurrent access on acquire()
Redis-py is not thread safe and in lock management, which means the following
can also happen:
1. lock.acquire()
2a. lock.release() ---\_ at the same time for all 2. operations
2b. lock.acquire() ---/
2c. lock.heartbeat() /
which means the lock can be when a lock is already acquired and in the process lock.acquire( )) lock.release( )) and remove it from
self._lock. acquire( ) where it's not (discard() does not raise on non-existing
of being released and re-acquired in paralllel:
1. acquire() acquire the lock (self._
2. release() release the lock (self._
element)
3. acquire() put the lock in _acquired_locks
4. heartbeat() iterates on _acquired_locks and try to extend a lock that indeed
was acquired but was in the mean time released by Redis.
Change-Id: Ib9549b44485cb1 5de312ec9dfa57b 148cb45e2c9 017ad181ace1e5b 7c5bff0d22)
Closes-Bug: #1557593
(cherry picked from commit 059f2ae5406a325