4 ms·
Another potential issue with antirez's argument: """ If you read the Redlock specification, that I hadn't touched for months, you can see the steps to acquire
by theptip 11y ago
Another potential issue with antirez's argument:
"""
If you read the Redlock specification, that I hadn't touched for months, you can see the steps to acquire the lock are:
1. Get the current time.
2. … All the steps needed to acquire the lock …
3. Get the current time, again.
4. Check if we are already out of time, or if we acquired the lock fast enough.
5. Do some work with your lock.
...
The above also addresses “process pauses” concern number 3. Pauses during the process of acquiring the lock don’t have effects on the algorithm's correctness.
"""
What if the process GCs for 2 minutes between 4 and 5? Then the lock times out, but the process still does its work with the lock, even though another process may think it has the lock as well.
This is a specific example of the criticism that you cannot rely on clock checks for correctness that has been made elsewhere.
- jamesblonde 11y agoYes, that's the most obvious flaw in his argument (amongst so many others). I'm surprised he (and his friends) didn't spot at least that one.
- antirez 11y agoThis is clearly addressed in the blog post. A GC pauae after step 3 is equivalent to any other pause after the lock is acquired. For example it's not different than a lock server replying OK to a lock request but the client only reads it after two minutes.
- cyphar 11y agoYes, but you can't predict how long it would take so you can't be sure the lock you acquired you still hold while operating on a shared resource.