1

I am using Hikari Connection Pool with Spring boot. I am using hikari connection pool and postgres with default configs.

I am seeing lot of warning like below

2023-01-31T06:07:54.4313140Z 2023-01-31 06:07:30.439  WARN [supplier,b516974ba1065b35,b516974ba1065b35] 12300 --- [ault-executor-1] com.zaxxer.hikari.pool.PoolBase          : HikariPool-1 - Failed to validate connection org.postgresql.jdbc.PgConnection@7d38668e (This connection has been closed.). Possibly consider using a shorter maxLifetime value.
2023-01-31T06:07:54.4313939Z 2023-01-31 06:07:30.440  WARN [supplier,b516974ba1065b35,b516974ba1065b35] 12300 --- [ault-executor-1] com.zaxxer.hikari.pool.PoolBase          : HikariPool-1 - Failed to validate connection org.postgresql.jdbc.PgConnection@7a88b46b (This connection has been closed.). Possibly consider using a shorter maxLifetime value.

I tried the below things as mentioned here. Both did not help

  1. hikariConfig.addDataSourceProperty("socketTimeout", hikariConfig.getMaxLifetime() + TimeUnit.SECONDS.toMillis(1));
  2. hikariConfig.addDataSourceProperty("idle_session_timeout", hikariConfig.getMaxLifetime() + TimeUnit.SECONDS.toMillis(1)); - With postgres 14.6

Version

  • HikariCP - 4.0.3
  • Spring Boot - 2.5.8
  • Postgres - 10.7
  • org.postgresql:postgresql - 42.5.1

I also tried upgrading postgres to the latest 14.6 and spring boot to 2.6.8. But still the same problem.

Can someone let me know what could be the problem & how to get around this warning?

tuk
  • 5,941
  • 14
  • 79
  • 162

0 Answers0