Intermittent HikariCP connection pool exhaustion with leaked connections not reclaimed
0 reputation · 07 Dec 2024, 04:23 UTC
Goal: Diagnose intermittent HikariCP connection pool exhaustion and determine if the pool can be configured to automatically reclaim connections that exceed the leakDetectionThreshold without manual intervention.
Constraint: HikariCP logs leaked connections when they surpass leakDetectionThreshold but does not evict them; the pool waits for the application thread to return the connection or for the thread to terminate. Operators must choose between waiting, restarting the pool, or deploying a background reaper that calls evictConnection(), which may interrupt legitimate long‑running transactions. No existing configuration or extension point forces reclamation, leaving this behavior unresolved.
Questions: Is there a way to enable automatic eviction of leaked connections without restarting the pool? What are the safety implications of using a custom reaper that calls evictConnection() on connections exceeding a threshold? Does HikariCP provide any hook or configuration option to force reclamation of connections that have been held beyond leakDetectionThreshold?