Connection pool issue after migration spring boot 3 hibernate 6 [duplicate]

1 week ago 14
ARTICLE AD BOX

I recently migrated my application from Spring Boot 2 with Hibernate 5 to Spring Boot 3 with Hibernate 6 in a testing environment. Since the migration, I encounter issues during high load (overload conditions).

The main problems are:

I see logs like:

HikariPool-1 - Connection is not available, request timed out after 30000ms (total=0, active=0, idle=0, waiting=1)

Additionally, I get errors such as:

message='Internal error', description='Could not open JPA EntityManager for transaction'

These errors occur particularly on a specific query:

@Lock(LockModeType.PESSIMISTIC_WRITE) @Query("SELECT so FROM ServiceOrder so WHERE so.id = ?1") Optional<ServiceOrder> findByIdWithPessimisticWriteLock(String serviceOrderUuid);

I have explicitly set the HikariCP pool size in my configuration: properties

spring.datasource.hikari.maximum-pool-size=30 spring.datasource.hikari.minimum-idle=10

What I’ve observed:

The issue appears during overload conditions, when many requests are processed simultaneously.

The pool configuration (max size, timeouts) is unchanged from the previous setup, which was working fine with Spring Boot 2 + Hibernate 5.

Questions:

Is this behavior expected after migrating to Hibernate 6?

Any guidance or suggestions would be greatly appreciated!

Thanks in advance.

Read Entire Article