-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Quarkus keeps dead database connections in its connection pool #15025
Comments
@yrodiere maybe you could have a look to this one given you played a bit with connections lately? |
It's a leak in Agroal. I've been trying to figure out how it could happen for a few days now, and with the reproducer provided by @TobiWeier I was finally able to crack it down. |
We might be affected by this as well. |
In which version of Quarkus we can expect a solution to the problem? |
I think agroal/agroal@1929c97 is the relevant commit, it will depend on when @barreiro does a release of Agroal. |
Describe the bug
Dead database connections are not removed from the pool. Since these are unusable, Quarkus has to make further connections. If the pool is filled completely with dead connections, it becomes unusable. The status of the pool remains permanently on DOWN, even when the database is available again.
Expected behavior
Agroal connection pool should be able to remove dead database connections from pool.
Actual behavior
If the connected database crashes or the connected database cluster performs a leader switch, agroal connection pool helds dead connections as available connections in pool. Every crash/leader-switch increases the number of supposedly "available" but in fact dead connections in pool. If the maximum number of connections is reached, the pool status remains permanently on DOWN, even when the database is available again.
To Reproduce
Link to a small reproducer (preferably a Maven project if the issue is not Gradle-specific).
https://github.com/TobiWeier/quarkus-dead-connections-issue
Steps to reproduce the behavior (with creating project from scratch):
Create quarkus project
add hibernate-orm dependencies
add quarkus-smallrye-metrics dependency
add quarkus-smallrye-health dependency
add properties to application.properties (as described below)
start database
start quarkus
use command for watching metrics from connection pool
use command for watching health status
kill or stop database
restart database
After db restart the number of available connections in pool has grown from 3 to 4. Now repeat steps 10 and 11 two times and observe the metrics values "vendor_agroal_available_count" and the health status. If the maximum number of connections is reached, the pool status remains permanently on DOWN, even when the database is available again.
Configuration
Screenshots
(If applicable, add screenshots to help explain your problem.)
Environment (please complete the following information):
Output of
uname -a
orver
:Linux nb-8y1r 5.4.0-65-generic #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
:GraalVM version (if different from Java):
Quarkus version or git rev:
1.11.3.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
):Apache Maven 3.6.3
Additional context
(Add any other context about the problem here.)
The text was updated successfully, but these errors were encountered: