-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Lock] Release PostgreSqlStore connection lock on failure #44723
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
[Lock] Release PostgreSqlStore connection lock on failure #44723
Conversation
Hey! To help keep things organized, we don't allow "Draft" pull requests. Could you please click the "ready for review" button or close this PR and open a new one when you are done? Note that a pull request does not have to be "perfect" or "ready for merge" when you first open it. We just want it to be ready for a first review. Cheers! Carsonbot |
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(for 5.3)
@nicolas-grekas I rebased it on the 5.3 branch |
Thanks for this fix @simon-watiau. I'm wondering if we can add a test in The |
@@ -50,4 +51,34 @@ public function testInvalidDriver() | |||
$this->expectExceptionMessage('The adapter "Symfony\Component\Lock\Store\PostgreSqlStore" does not support'); | |||
$store->exists(new Key('foo')); | |||
} | |||
|
|||
/** | |||
* @requires extension pdo_sqlite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed I suppose
Thank you @simon-watiau. |
… on failure (simon-watiau) This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [Lock] Release DoctrineDbalPostgreSqlStore connection lock on failure | Q | A | ------------- | --- | Branch? | 5.4<!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | <!-- required for new features --> When using PostgreSQL advisory locks using the `DoctrineDbalPostgreSqlStore` A first lock is acquired in memory for same connection concurrencies, this `InMemoryStore` does not rely on TTL. When the advisory lock fails to be acquired, this first lock is not released. For long running processes, this cause the lock to not be acquirable again because the `InMemoryStore` will never release its lock. related to : #44723 (comment) Commits ------- fab5991 [Lock] Release DoctrineDbalPostgreSqlStore connection lock on failure
When using PostgreSQL advisory locks using the
PostgreSqlStore
A first lock is acquired in memory for same connection concurrencies, this
InMemoryStore
does not rely on TTL.When the advisory lock fails to be acquired, this first lock is not released.
For long running processes, this cause the lock to not be acquirable again because the
InMemoryStore
will never release its lock.