hibernate/hibernate-orm · error · HibernateException

The internal connection pool has reached its maximum size an

Error message

The internal connection pool has reached its maximum size and no connection is currently available

What it means

Error "The internal connection pool has reached its maximum size and no connection is currently available" thrown in hibernate/hibernate-orm.

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)

Solutions

  1. Increase 'hibernate.connection.pool_size' or reduce concurrent connection usage
  2. Ensure connections are returned/closed promptly so the pool is not exhausted
  3. Use a real connection pool (HikariCP, c3p0, Agroal) for production workloads

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.