Skip to content

Conversation

@rPraml
Copy link
Collaborator

@rPraml rPraml commented Feb 27, 2025

We observed on a network outage, that the pool needs a very long time to recover (up to 2 hours) or even dead locks.

We could not reproduce this exactly in a testcase, but we think, that closeBusyConnections must wait for locks hold in the connection or statements.

A simple testcase is written for H2, where the thread holds a synchronized lock on the H2 connection. This avoids a proper shutdown of the pool

I would suggest to run closeConnectionFully in an async thread (with a timeout of 5 seconds), because you never know, if connection.close will block and locks up the whole application.

@rPraml rPraml force-pushed the close-connections-async branch from 22fd6b0 to ffbc5a8 Compare February 28, 2025 08:31
@rPraml rPraml force-pushed the close-connections-async branch from ffbc5a8 to 863696d Compare February 28, 2025 09:47
@rPraml
Copy link
Collaborator Author

rPraml commented Feb 28, 2025

Unfortunately it may happen, that a connection.close() may block due lock/race condition or even due a programming error in the driver.
We observed this in conjunction with DB2 + Javamelody when a network disconnect happened

Unfortunately we have not yet managed to reproduce the error with DB2, but I managed to write a test with H2 that holds a synchronized lock in an other thread on the connection so that another connection.close by the pool is blocked.

@rbygrave This is a proposal, how to close async connections. What do you think about this change in principle.

I can add a config flag closeConnectionsAsync so that you can switch between the new and old behaviour.

@rPraml
Copy link
Collaborator Author

rPraml commented Mar 3, 2025

Waiting for #115 (it may solve some of the issues here...)

@rPraml
Copy link
Collaborator Author

rPraml commented Apr 14, 2025

Obsolete by #127

@rPraml rPraml closed this Apr 15, 2025
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

Successfully merging this pull request may close these issues.

1 participant