brettwooldridge/HikariCP · error · SQLException
${poolName} - Interrupted during connection acquisition
Error message
${poolName} - Interrupted during connection acquisition What it means
HikariPool.getConnection() waits on the connection bag with interrupts enabled; if the waiting thread is interrupted it restores the interrupt flag and wraps the InterruptedException in a SQLException tagged with the pool name. This preserves JDBC's checked-exception contract while not swallowing the interrupt.
Source
Thrown at src/main/java/com/zaxxer/hikari/pool/HikariPool.java:188
else {
metricsTracker.recordBorrowStats(poolEntry, startTime);
if (isRequestBoundariesEnabled) {
try {
poolEntry.connection.beginRequest();
} catch (SQLException e) {
logger.warn("beginRequest Failed for: {}, ({})", poolEntry.connection, e.getMessage());
}
}
return poolEntry.createProxyConnection(leakTaskFactory.schedule(poolEntry));
}
} while (timeout > 0L);
metricsTracker.recordBorrowTimeoutStats(startTime);
throw createTimeoutException(startTime);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new SQLException(poolName + " - Interrupted during connection acquisition", e);
}
finally {
suspendResumeLock.release();
}
}
/**
* Shutdown the pool, closing all idle connections and aborting or closing
* active connections.
*
* @throws InterruptedException thrown if the thread is interrupted during shutdown
*/
public synchronized void shutdown() throws InterruptedException
{
try {
poolState = POOL_SHUTDOWN;
if (addConnectionExecutor == null) { // pool never startedView on GitHub (pinned to a4d93f4f85)
Solutions
- Find who interrupts the thread (shutdownNow, Future.cancel(true), thread pools) and avoid interrupting tasks blocked on JDBC
- Tune connectionTimeout / maximumPoolSize so acquisition does not block long enough to be interrupted
- Catch SQLException and re-check Thread.currentThread().isInterrupted() to honor cancellation
- Fix the upstream cause: database slowness or pool exhaustion making threads wait in the first place
Example fix
// before Future<Connection> f = pool.submit(() -> ds.getConnection()); f.cancel(true); // interrupts thread inside getConnection -> SQLException // after // let the task finish or use connectionTimeout to bound waiting: HikariConfig cfg = new HikariConfig(); cfg.setConnectionTimeout(3000); // bounded wait, no interrupt needed
Defensive patterns
Strategy: try-catch
Try / catch
try { conn = ds.getConnection(); }
catch (SQLException e) {
if (Thread.currentThread().isInterrupted()) {
Thread.currentThread().interrupt();
// honor cancellation: abort this unit of work
}
throw e;
} Prevention
- Never Future.cancel(true) tasks that may block in getConnection
- Bound waiting via connectionTimeout so interrupts are unnecessary
- Keep pool capacity adequate to avoid long acquisition waits
When it happens
Trigger: Thread interrupt during pool shutdown (shutdownExecutor interrupting waiters); application thread timeouts cancelling tasks that are blocked in getConnection (e.g. Future.cancel(true)); connectionPoolTimeout reached while another component interrupts; app server worker thread reclamation.
Common situations: ExecutorService.shutdownNow() while tasks wait for connections under DB outage, request-cancellation frameworks, slow database + aggressive timeouts.
Related errors
- HikariDataSource ${dataSource} has been closed.
- Connection is closed
- connectionTimeout cannot be less than ${SOFT_TIMEOUT_FLOOR}m
- idleTimeout cannot be negative
- maxPoolSize cannot be less than 1
AI-assisted analysis of brettwooldridge/HikariCP@a4d93f4f85 (2026-08-14).
Data as JSON: /api/errors/c768cebb83ec2537.
Report an issue: GitHub.