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

readonly transactions used in section where no readonly transactions are allowed (happens only if there are readonly sections elsewhere) #212

Open
anschnapp opened this issue May 28, 2024 · 0 comments

Comments

@anschnapp
Copy link

anschnapp commented May 28, 2024

Bug Report

Versions

  • Driver: r2dbc-pool:1.0.1.RELEASE
  • Database: postgres
  • Java: 17
  • OS: debian11

Current Behavior

I have a little spring boot service which used r2dbc with the pool.

I have multiple endpoints which at the end are calling code which supports transactions.
Some are readonly (and therefore have no write operations) and some are transactions with readonly=false which does some write operations.

From our logs we realized that we sometimes we got issues with read only transactions trying to do some write operations.
But these issues was happening at code sections which are configured for using "writeable transactions".

We assume that the pool will reuse some connection which had a readonly flag for writeable transactions.

For now as a workaround we removed the read only tx blocks completely and the error is gone.

Steps to reproduce

I guess it might be reproducable if you had a service with readonly and not readonly operations and simulate a high load. However this time i don't have found the time for a "minimal reproducable example project".

Expected behavior/code

Read only transactions should never be used in code which required a transaction of read only = false. Regardless if readonly transactions are used in other sections of the code.

Possible Solution

Check if connection with readonly = true are somehow reused, and if it could happen that they are reused for "writeable transactions". (and then fix it ;))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant