-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[symfony/lock] Lock always expired #31426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
Maybe we should remove the expire time check from here.
|
cc @jderusse |
Thanks @slince for the reproduct case and the clear and deep investigation! I'm working on a fix. |
fabpot
added a commit
that referenced
this issue
Jun 17, 2019
This PR was merged into the 3.4 branch. Discussion ---------- Fix expired lock not cleaned | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #31426 | License | MIT | Doc PR | NA When a lock is acquired BUT not as fast as expected, a LockExpiredException is thrown. Issue is, that the lock is not removed which avoid other process to acquire that lock. This PR clean state of store when a LockExpiredException is triggered. note: same bug should be fixed in 4.3 in PDO and Zookeeper Commits ------- 9f960f3 Fix expired lock not cleaned
nicolas-grekas
added a commit
that referenced
this issue
Jun 17, 2019
This PR was merged into the 4.3 branch. Discussion ---------- [Lock] Fix expired lock not cleaned in ZooKeeper | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | ,p | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no | Tests pass? | yes | Fixed tickets | #31426 | License | MIT | Doc PR | NA Following #32071 for 4.3 branch context: When a lock is acquired BUT not as fast as expected, a LockExpiredException is thrown. Issue is, that the lock is not removed which avoid other process to acquire that lock. This PR clean state of store when a LockExpiredException is triggered in PDO and ZooKeepeer. Commits ------- 4f808ef Fix Expiring lock in PDO and ZooKeeper
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Symfony version(s) affected: 3.4.27
Description
When multiple processes get a lock, the lock expired exception will always appear, no any processes can successfully acquire the lock.
How to reproduce
Additional context
RedisStore
$initialTtl = 20
Assuming the current time is
10:00s
, the process "A" and the process "B" are ready to acquire the lock "foo", "foo" will be released at 10:20;At 10:20s:
A
successfully acquires the lock, accourding tosymfony/src/Symfony/Component/Lock/Store/RedisStore.php
Line 57 in a9bb118
The expire time of the key in the redis will be modified to
10:40s
; but since the key expire time in memory is10:20s
, theA
will exit because the program does not captureLockExpriedException
and thenA
will be restart by the supervisor;At 10:40s:
The
B
acquires the lock, and the redis expire time will be modified to11:00s
, but also because the expire time in memory (10:20s
) timeout,B
will also exit and restart;After that,
A
andB
get the locks in turn, and extend the expiration time by$initialTtl = 20s
. but since the the expiration time in memory is not updated, no process can successfully acquire the lock.The text was updated successfully, but these errors were encountered: