Open JonasBRasmussen opened 3 years ago
Hi @JonasBRasmussen, I see similar behaviour on our environment but then with a Oracle DB. Did you ever found a root cause or something like that for this issue?
Hi @fdkuiper, Unfortunately not. I've had to learn to live with it.
Seeing the exact same issue with Azure SQL DB + Spring Boot App + HikariCP v3.4.5 which is running as a traditional service (not microservice) on a server.
Hi all. I too am dealing with this issue at the moment but with Azure SQL DB. I even tryied setting the socketTimeout configuration on the connection string as suggested in another issue I can't find at the moment but the problem occurred again.
The project is running the following versions. Java 1.8 Spring Boot 2.3.4.RELEASE HikariCP 3.4.5 mssql-jdbc 7.4.1.jre8
Configuration: `spring: datasource: driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://${DATABASE-URL};database=${DATABASE-NAME};user=${DATABASE-USER};password=${DATABASE-PASSWORD};encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword;socketTimeout=60000
hikari:
minimum-idle: 10
maximum-pool-size: 50
jpa: show-sql: true default-schema: DL hibernate: dialect: org.hibernate.dialect.SQLServer2019Dialect ddl-auto: none default-schema: DL properties: hibernate.default_schema: DL`
The issue is happening randomly on one of 15 different microservices that continue working normally.
The logs for when it happens
2022-09-27 06:04:48.052 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - After adding stats (total=10, active=0, idle=10, waiting=0) 2022-09-27 06:04:48.052 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection ConnectionID:28436 ClientConnectionId: ef2dcaa5-e667-4acd-8d2e-4aa1c99a09b1 2022-09-27 06:05:01.359 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0) 2022-09-27 06:05:01.359 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Fill pool skipped, pool is at sufficient level. 2022-09-27 06:05:13.369 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:28427 ClientConnectionId: 51b982af-e019-4903-9394-ad3dd770569b: (connection has passed maxLifetime) 2022-09-27 06:05:14.004 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection ConnectionID:28437 ClientConnectionId: 08e710af-a1a5-4732-85af-afdb171274ed 2022-09-27 06:05:14.193 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:28428 ClientConnectionId: d0dd9754-653f-4d51-81ee-68ca3ce52c38: (connection has passed maxLifetime) 2022-09-27 06:05:14.235 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Add connection elided, waiting 0, queue 1 2022-09-27 06:05:14.235 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:28429 ClientConnectionId: 0e7fc772-760e-48f8-9c27-75462e9ba0ab: (connection has passed maxLifetime) 2022-09-27 06:05:14.635 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection ConnectionID:28438 ClientConnectionId: 3ce42328-b375-4550-b8c0-397953872988 2022-09-27 06:05:14.756 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Add connection elided, waiting 0, queue 1 2022-09-27 06:05:14.756 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:28430 ClientConnectionId: ebd8ab1a-5937-49ed-bd93-c254dd6c26d3: (connection has passed maxLifetime) 2022-09-27 06:05:15.050 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:28431 ClientConnectionId: 5789c582-f285-4a22-861a-473104e2d11e: (connection has passed maxLifetime) 2022-09-27 06:05:15.050 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Add connection elided, waiting 0, queue 2 2022-09-27 06:05:15.953 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:28432 ClientConnectionId: 08bc282b-38e6-406f-8843-2e6975a128e8: (connection has passed maxLifetime) 2022-09-27 06:05:15.953 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Add connection elided, waiting 0, queue 3 2022-09-27 06:05:16.507 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Add connection elided, waiting 0, queue 4 2022-09-27 06:05:16.507 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:28433 ClientConnectionId: 4ea3be9b-74ed-458c-ae93-f0fa396b71fc: (connection has passed maxLifetime) 2022-09-27 06:05:17.034 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:28434 ClientConnectionId: a92d34b5-4549-4ced-8549-63f5f704855d: (connection has passed maxLifetime) 2022-09-27 06:05:17.034 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Add connection elided, waiting 0, queue 5 2022-09-27 06:05:17.038 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:28435 ClientConnectionId: c395008c-733f-4132-93e1-c3be1ee706b1: (connection has passed maxLifetime) 2022-09-27 06:05:17.037 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Add connection elided, waiting 0, queue 6 2022-09-27 06:05:17.374 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:28436 ClientConnectionId: ef2dcaa5-e667-4acd-8d2e-4aa1c99a09b1: (connection has passed maxLifetime) 2022-09-27 06:05:17.374 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Add connection elided, waiting 0, queue 7 2022-09-27 06:05:31.360 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Fill pool skipped, pool is at sufficient level. 2022-09-27 06:05:31.360 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=2, active=0, idle=2, waiting=0) 2022-09-27 06:05:43.431 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Add connection elided, waiting 0, queue 8 2022-09-27 06:05:43.431 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:28437 ClientConnectionId: 08e710af-a1a5-4732-85af-afdb171274ed: (connection has passed maxLifetime) 2022-09-27 06:05:44.097 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Add connection elided, waiting 0, queue 9 2022-09-27 06:05:44.097 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:28438 ClientConnectionId: 3ce42328-b375-4550-b8c0-397953872988: (connection has passed maxLifetime) 2022-09-27 06:06:01.360 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=0, active=0, idle=0, waiting=0) 2022-09-27 06:06:01.360 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Fill pool skipped, pool is at sufficient level. 2022-09-27 06:06:31.360 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Fill pool skipped, pool is at sufficient level. 2022-09-27 06:06:31.360 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=0, active=0, idle=0, waiting=0)
@JonasBRasmussen How did you learn to live with it? This seems like an unliveable bug.. are you just implementing some health checks and restarts?
@slychops This is exactly what we did.. It is definitely not what we wanted, but we couldn't find any other solution.
For us is happening on version 5.0.0 while connecting to an Azure SQL Server.
Hello, We are also facing same issue :( Hi everyone, anybody solved this issue, we are facing with HikariCP v5.0.1
Connection pool settings minimumIdle: 5 maximumPoolSize: 30 maxLifetime: default 30 min connectionTimeout: 180000 idleTimeout : 600000
database : Azure SQL DB detailed Logs added in issue : https://github.com/brettwooldridge/HikariCP/issues/1710
Hi everyone! Are there any updates on this?
Any solution found for this issue ?? I'm facing similar kind of issue where connection are getting elided during high load and cpu usage reaches up to 98%.
I am experiencing a peculiar problem that seems to be related to the use of minikube.
I am running a PostgreSQL 13 pod (with no custom configuration) in minikube and connecting to it from my application in IntelliJ. After a while, no connections are created to replace the ones that are closed by Hikari, because Hikari feels that there are no waiting threads. I have tried running the same application, but connecting it to a PosgreSQL 13 Docker container instead (using Docker Desktop on Windows 10), and then the problem disappears.
I am hoping someone with Hikari (and possibly minikube, kubernetes and PostgreSQL) insight that can help me figure out what the problem is (Hikari configuration, minikube configuration, PostgreSQL configuration, etc.).
I have created a minimal Spring Boot application that reproduces the problem. It consists of the following two classes (I am using scheduling to avoid the application shutting down immediately):
The
application.yaml
looks like this (notice the low values - this is so the problem occurs in at most a few minutes):The
build.gradle
looks like this:Running this application gives the following log messages:
After which the application starts failing because no connections are available:
The interesting messages are these, where the number of waiting threads is always 0, while the queued threads just increase:
When the application starts, Hikari is clearly able to add 10 connections without any issue. Hikari then (sometimes) add new connections when old connections are closed, but mostly not, because the
addBag
method is (almost) always called with the value0
. Thus it varies from run to run how long it takes for the pool to become empty. With the 30s max lifetime, it is never more than a couple of minutes though.