commit 0dc996b92dd66a5da5e75966df3a59fabc6df420
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/484880 /git.openstack. org/cgit/ openstack/ tooz/commit/ ?id=0dc996b92dd 66a5da5e75966df 3a59fabc6df420
Committed: https:/
Submitter: Jenkins
Branch: stable/ocata
commit 0dc996b92dd66a5 da5e75966df3a59 fabc6df420
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