Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Lock] Release DoctrineDbalPostgreSqlStore connection lock on failure #44828

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

Merged
merged 1 commit into from
Dec 29, 2021
Merged

[Lock] Release DoctrineDbalPostgreSqlStore connection lock on failure #44828

merged 1 commit into from
Dec 29, 2021

Conversation

simon-watiau
Copy link
Contributor

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets
License MIT
Doc PR

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)

@carsonbot carsonbot added this to the 6.1 milestone Dec 28, 2021
@simon-watiau simon-watiau changed the base branch from 6.1 to 5.4 December 28, 2021 14:37
@nicolas-grekas
Copy link
Member

Thank you @simon-watiau.

@nicolas-grekas nicolas-grekas merged commit 5c5ac42 into symfony:5.4 Dec 29, 2021
@simon-watiau simon-watiau deleted the fix/PostgreSqlStore-not-releasing-session-locks-5.4 branch December 29, 2021 10:20
This was referenced Dec 29, 2021
chrisguitarguy added a commit to chrisguitarguy/symfony that referenced this pull request Feb 23, 2022
if something goes wrong talking with the database connection (like a
disconnect or timeout) the parent `Lock` object will catch and simply
say that there was an error acquring the lock. However, waitAndSave and
waitAndSaveRead both store the lock in an internal store so trying to
re-acquire the lock with the same connection would result in a lock
confliected exception even though the lock was never acquired in the
first place.

This takes the fix from symfony#44828
and applies it to the waitAndSave and waitAndSaveRead methods on both
DoctrineDbalPostgreSqlStore and PostgreSqlStore.
nicolas-grekas added a commit that referenced this pull request Feb 24, 2022
…ndSave* (chrisguitarguy)

This PR was squashed before being merged into the 5.4 branch.

Discussion
----------

[Lock] Release Locks from Internal Store on Postgres waitAndSave*

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #45505
| License       | MIT
| Doc PR        | n/a

if something goes wrong talking with the database connection (like a
disconnect or timeout) the parent `Lock` object will catch and simply
say that there was an error acquring the lock. However, waitAndSave and
waitAndSaveRead both store the lock in an internal store so trying to
re-acquire the lock with the same connection would result in a lock
confliected exception even though the lock was never acquired in the
first place.

This takes the fix from #44828
and applies it to the waitAndSave and waitAndSaveRead methods on both
DoctrineDbalPostgreSqlStore and PostgreSqlStore.

Commits
-------

32a0f50 [Lock] Release Locks from Internal Store on Postgres waitAndSave*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.