문제
아래의 에러가 뜨면서 커넥션 연결이 실패하는 이슈가 발생했다.
WARN 1 --- [Jinus] [io-5100-exec-10] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Failed to validate connection org.postgresql.jdbc.PgConnection(This connection has been closed.). Possibly consider using a shorter maxLifetime value.
Bash
복사
로그의 내용을 의역하면 아래와 같다.
•
Hikari Pool의 connection을 validate하는 데 실패 했다.
•
이미 close된 connection에 어떤 operation을 하는 것은 안된다.
•
HikariPool의 maxLifetime 값을 짧게 하는 것을 생각해봐라.
DEBUG 1 --- [Jinus] [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection org.postgresql.jdbc.PgConnection@295502e3: (connection is dead)
SQL
복사
원인
maxLifeTime
maxLifetime
This property controls the maximum lifetime of a connection in the pool.
An in-use connection will never be retired, only when it is closed will it then be removed.
On a connection-by-connection basis, minor negative attenuation is applied to avoid mass-extinction in the pool.
We strongly recommend setting this value, and it should be several seconds shorter than any database or infrastructure imposed connection time limit.
A value of 0 indicates no maximum lifetime (infinite lifetime), subject of course to the idleTimeout setting.
The minimum allowed value is 30000ms (30 seconds). Default: 1800000 (30 minutes)
커넥션 풀에서 idle 커넥션이 최대 얼마동안 생존할 수 있냐는 설정이다.
(단위는 ms, 기본값은 30분, 최소값은 30초, 0으로 설정하면 무제한)
반환될 때마다 idle time은 다시 0으로 초기화 될테니 트래픽이 많이 들어와서 커넥션이 계속 사용되는 서비스라면 이 설정에 의해 커넥션이 종료될 일은 적을 것이다.