Spring Boot Interview Question: HikariCP Connection Timeout
Connection pool, transaction boundary, timeouts and more...
Scenario
You have a Spring Boot application using HikariCP with the following configuration:
spring.datasource.hikari:
maximum-pool-size: 10
connection-timeout: 30000The application receives low QPS (5β10 requests/sec), but you occasionally see this error in the logs:
HikariPool-1 - Connection is not available, request timed out after 30000ms.What does this HikariCP error actually mean?
All connections in the pool are checked out and none became available within connectionTimeout(30s).
Common misconception: Itβs not necessarily due to high traffic; it often means connections are held too long or never returned.
π’ Get actionable Java/Spring Boot insights every week β from practical code tips to real-world use-case based interview questions.
Join 4300+ subscribers and level up your Spring & backend skills with hand-crafted content β no fluff.
Become paid subscriber and unlock all the benefits at $2.5/mo (with annual subscription).
Not convinced? Check out the details of the past work
Why it happens at low QPS
Connections are not being released (most common)
Typical causes:
Missing transaction boundaries
@Transactional public void methodA() { methodB(); // starts another transaction? }Nested / mis-scoped transactions
Long-lived transactions
Transactions around non-DB logic
SymptomQPS is low
Active connections slowly climb
Pool never recovers
Fix
Keep transactions short
Wrap only DB work
Avoid
@Transactionalon controllers




