-
Notifications
You must be signed in to change notification settings - Fork 364
Description
When performing n
repository queries in parallel, where n >= maximumPoolSize
, all queries seems to be stuck and hikaricp pool do not have free connections. Getting error:
HikariPool-1 - Connection is not available, request timed out after 30002ms.
Preconditions:
- Selecting aggregate entity with 1-n relationship
@Trasactional
annotation is not added
I have made small demo project to showcase this problem:
https://github.com/zygisx/demo-spring-data-jdbc-problem
As you can see database aggregate contains 1-n relationship UserEntity -> UserEmailAddress: link
Whenever i add @Transactional
annotation to repository problem is gone. Though spring-data-jdbc documentation states that:
CRUD methods on repository instances are transactional by default
https://docs.spring.io/spring-data/jdbc/docs/current/reference/html/#jdbc.transactions
Tests in demo project showcases this issue
https://github.com/zygisx/demo-spring-data-jdbc-problem/blob/main/src/test/kotlin/com/example/demo/DemoApplicationTests.kt
When hikaricp maximumPoolSize
is 10. Tests which performs 9 parallel calls to Repository passes.
Though test which performs 10 parallel calls to repository fails with HikariPool-1 - Connection is not available, request timed out after 30002ms.
.
If You see that i can provide more info regarding this issue feel free to contact me.
Thanks for looking into it ;)