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

Postgres Connection left in OPEN transaction when autoCommit=false and maxLifetime is reached #2235

Open
kevinchan-rl opened this issue Sep 9, 2024 · 4 comments

Comments

@kevinchan-rl
Copy link

kevinchan-rl commented Sep 9, 2024

Hi,

We noticed our connection pool becomes unusable after maxLifetime has been reached with runtime exception PSQLException: Cannot change transaction isolation level in the middle of a transaction when trying to set the isolation level the first time after getting the connection from the datasource. We are using exposed 0.51 in kotlin.

We have autoCommit=false and default schema set on the hikari datasource.

Attached are the postgres logs for when autoCommit=false and autoCommit=true and you can see the connection init for both the first time and when maxLifetime is reached. Notice that the transaction is left open when autoCommit=false when maxLifetime is reached.

@kevinchan-rl
Copy link
Author

@kevinchan-rl
Copy link
Author

potentially a duplicate of #2144

@quaff
Copy link
Contributor

quaff commented Sep 27, 2024

potentially a duplicate of #2144

It's a duplicate and should be fixed at PostgreSQL JDBC Driver side, see pgjdbc/pgjdbc#3005

@brettwooldridge
Copy link
Owner

This is disturbing. I do suspect it is caused by the referenced pgjdbc issue. I'm not sure what the pool can do to compensate for this behavior; I don't want to automatically Connection.commit() every time the connection is returned to the pool or the schema is changed.

@kevinchan-rl Can you post your pool configuration?

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

No branches or pull requests

3 participants