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

Transactions get's stuck under curtain conditions #643

Closed
anschnapp opened this issue Mar 18, 2024 · 2 comments
Closed

Transactions get's stuck under curtain conditions #643

anschnapp opened this issue Mar 18, 2024 · 2 comments
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@anschnapp
Copy link

anschnapp commented Mar 18, 2024

Bug Report

Versions

  • Driver: org.postgresql:r2dbc-postgresql -> 1.0.4.RELEASE
  • Database: 16.2

Description

It seems like under some circumstances connections get stucked, we face a big issue because of this where our service gets unresponsable and almost unusable.

We are using r2dbbc with postgres and spring boot.

After a long time of debugging we still don't find the root cause but we could successfully reproduce it.
Also we we're able to create a minimal reproduce example for this issue, you could review and try it out yourself here:
https://github.com/anschnapp/r2dbc-issue-531-reproducer
(their is also a mysql branch where you can see that this don't happen with other db drivers)

From our perspective multiple conditions have to be met to reproduce it:

  • a method which uses multiple database operations inside one transaction (in our example a select and a update query)
  • at least as much "parallel" caller of the method as capacity in the connection pool (so at least 10 if you use the default pool size)
  • some mono/future conversions: like Mono.fromFuture(writeAndReadOperation(round).toFuture())

The last condition may appear to be a strange case. But there are some valid scenarios where such mono and future conversions are required.

We use it because of the usage of a caffeine cache which don't have a reactive api but a future based api.
Also we guess that other sequences of reactive chains might have the same effect here, it's hard to say without knowing the real root cause for this.

We also think that this issue could be related to (#531) (that's why we had this ticket number in our example repo name).
But our issue might be different it has quite many pre requirements. The other ticket seems to be much broader.

EDIT: It seems to be transaction specific (and not simple connections)

@anschnapp anschnapp added the status: waiting-for-triage An issue we've not yet triaged label Mar 18, 2024
@anschnapp anschnapp changed the title Connections get's stuck under curtain conditions Transactions get's stuck under curtain conditions Mar 18, 2024
@anschnapp
Copy link
Author

ok it seems like i had make a mistake. it seems like it was transaction independent but it was not.

with transactions also the mysql driver hangs, so i guess this issue is not inside the specific drivers but i don't know maybe in the spring r2dbc code...

do you know where to put this? of course this could be closed on your side if this is not an issue of the postgres driver

@anschnapp
Copy link
Author

i have moved it to: r2dbc/r2dbc-pool#208

because it doesn't seem to be postgres driver specific and i guess it's about the pool

i will close it here now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

1 participant