Skip to content

Commit

Permalink
minor #32075 [Lock] Fix expired lock not cleaned in ZooKeeper (jderusse)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nicolas-grekas committed Jun 17, 2019
2 parents 15652e3 + 4f808ef commit 5af1e9e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Symfony/Component/Lock/Store/ZookeeperStore.php
Expand Up @@ -25,6 +25,8 @@
*/
class ZookeeperStore implements StoreInterface
{
use ExpiringStoreTrait;

private $zookeeper;

public function __construct(\Zookeeper $zookeeper)
Expand All @@ -45,6 +47,8 @@ public function save(Key $key)
$token = $this->getUniqueToken($key);

$this->createNewLock($resource, $token);

$this->checkNotExpired($key);
}

/**
Expand Down

0 comments on commit 5af1e9e

Please sign in to comment.