hibernate/hibernate-orm · error · HibernateException
The internal connection pool has reached its maximum size…
Error message
The internal connection pool has reached its maximum size and no connection is currently available
What it means
PooledConnections.poll found the pool at its configured max size with every connection checked out, so no connection can be served. Raised when concurrency exceeds hibernate.connection.pool_size; the situation is transient — connections free up as they are released.
Solutions
- Increase 'hibernate.connection.pool_size' or reduce concurrent connection usage
- Ensure connections are returned/closed promptly so the pool is not exhausted
- Use a real connection pool (HikariCP, c3p0, Agroal) for production workloads
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/internal/PooledConnections.java:102 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/1f3889ac1622b139.
Report an issue: GitHub.
Appendix: source
Thrown at hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/internal/PooledConnections.java:102
t = ex;
}
closeConnection( conn, t );
CONNECTION_INFO_LOGGER.connectionReleaseFailedClosingPooledConnection( t );
return null;
}
Connection poll() {
Connection conn;
do {
conn = availableConnections.poll();
if ( conn == null ) {
synchronized (allConnections) {
if ( allConnections.size() < maxSize ) {
addConnections( 1 );
return poll();
}
}
throw new HibernateException(
"The internal connection pool has reached its maximum size and no connection is currently available" );
}
conn = prepareConnection( conn );
}
while ( conn == null );
return conn;
}
protected Connection prepareConnection(Connection conn) {
Exception t = null;
try {
conn.setAutoCommit( autoCommit );
if ( connectionValidator.isValid( conn ) ) {
return conn;
}
}
catch (SQLException ex) {
t = ex;View on GitHub (pinned to fad1729dce)