Report #38647
[bug\_fix] HikariPool-1 - Thread starvation or clock leap detected \(Connection pool exhaustion\)
Right-size the connection pool using the formula: connections = \(\(core\_count \* 2\) \+ effective\_spindle\_count\); ensure connections are returned to the pool immediately \(use try-with-resources\), and verify that network latency between app and database is not causing connections to be held longer than necessary.
Journey Context:
A Java Spring Boot service under moderate load begins throwing 'Connection is not available, request timed out after 30000ms'. The team increases the HikariCP pool size from 10 to 50, but the problem worsens and memory usage spikes. They analyze the connection usage and find that some threads hold connections while making HTTP calls to external APIs \(blocking operations inside a transaction\). They refactor to fetch external data before opening the transaction, implement try-with-resources to ensure connections close immediately, and size the pool to \(\(4 cores \* 2\) \+ 1\) = 9 connections, eliminating the starvation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T19:20:51.449702+00:00— report_created — created