Skip to content
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

Fix PostgresSubscribableChannel.notifyUpdate() #8723

Merged

Conversation

artembilan
Copy link
Member

When transaction is configured for the PostgresSubscribableChannel.notifyUpdate() and it is rolled back, the next poll in that loop will return the same message. Again and again if transaction is always rolled back. This leads to the condition when we never leave this loop even if we fully unsubscribed from this channel.

The issue has need spotted after introducing SKIP LOCKED for PostgresChannelMessageStoreQueryProvider which leads to the locked record in DB in the mentioned above transaction.

  • Introduce PostgresSubscribableChannel.hasHandlers flag to check in the notifyUpdate() before performing poll query in DB.

Cherry-pick to 6.1.x & 6.0.x

When transaction is configured for the `PostgresSubscribableChannel.notifyUpdate()`
and it is rolled back, the next poll in that loop will return the same message.
Again and again if transaction is always rolled back.
This leads to the condition when we never leave this loop even if
we fully unsubscribed from this channel.

The issue has need spotted after introducing `SKIP LOCKED`
for `PostgresChannelMessageStoreQueryProvider` which leads to
the locked record in DB in the mentioned above transaction.

* Introduce `PostgresSubscribableChannel.hasHandlers` flag
to check in the `notifyUpdate()` before performing poll query in DB.

**Cherry-pick to `6.1.x` & `6.0.x`**
@tzolov
Copy link
Contributor

tzolov commented Sep 18, 2023

LGTM. Ready to merge

@tzolov tzolov merged commit 78367f2 into spring-projects:main Sep 18, 2023
1 check passed
@artembilan
Copy link
Member Author

... and cherry-picked to 6.1.x & 6.0.x

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.

2 participants