Is there another race condition when a lock is released?
See original GitHub issueAs shown above, the step to release the lock is 1. Execute the UNLOCK
script 2. Execute the _delete_signal
function.
Consider a situation with two processes:
- Process 1 currently holds a lock.
- process 2 is ready to acquire the lock.
Now, suppose that the following sequence of events unfolds:
- process 2 executes the
SETNX
command to obtain the lock but does not get it. - Process 1 executes the
UNLOCK
script to release the lock. - process 1 executes the
_delete_signal
function. - process 2 executes the
BLPOP
command. It then waits for a timeout to acquire the lock again, and that’s the problem.
So I wonder why there ended up with a _delete_signal
function. Can you explain it a little bit?
I think this guy’s got the same problem. https://github.com/ionelmc/python-redis-lock/issues/58#issuecomment-348712157
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Race conditions and deadlocks - Visual Basic - Microsoft Learn
At least two threads are waiting for a variable that the other thread locked. The threads do not proceed, because neither thread will...
Read more >Reading 23: Locks and Synchronization
Deadlock. When used properly and carefully, locks can prevent race conditions. But then another problem rears its ugly head. Because the use of...
Read more >Race Conditions, Locks, Semaphores, and Deadlocks - Medium
A lock or mutex (from mutual exclusion) is a synchronization mechanism for enforcing limits on access to a resource in an environment where ......
Read more >What prevents a race condition on a lock?
When lock is equal to 0 another thread can enter to critical section - while loop ends. Thread suspending - for example counting...
Read more >Is there a race condition when a lock is released? #58 - GitHub
Now, suppose that the following sequence of events unfolds: Process 1 executes the UNLOCK script to release the lock. Pr...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
But does it work or get stuck? Or are you just complaining about efficiency?
Released
v3.4.0
.