-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Describe the bug
We tried to update our application to use Hibernate Reactive 2.4.6 to fix hibernate/hibernate-reactive#2007. While most of our tests worked, we observed one behavior that is concerning and indicates to us that the transaction boundaries are not respected correctly. Specifically, this seems to happen when mixing Panache and Vanilla Hibernate Reactive, e.g. because some specific queries need a SessionFactory.
One example we observed:
- Fetch an entity using Panache repository with PESSIMSTIC_WRITE lock and then wait (using a delay)
- Fetch the same entity using SessionFactory with PESSIMISTIC_WRITE
- Observe that both transactions obtain the lock at the same time (or rather, it seems to be a single transaction instead of two distinct ones?)
Expected behavior
We expect transaction boundaries to be respected. In the given example, the second transaction should need to wait until the first transaction released the lock before it can acquire it.
Actual behavior
As described, locks can be shared between seemingly distinct transactions. Most likely there are other negative side effects.
How to Reproduce?
Reproducer: https://github.com/markusdlugi/hr-transaction-reproducer
Steps to reproduce the behavior:
- Run
CounterResourceTest
- Observe that
should_increase_count_sequentially_using_only_panache()
is always successful, whileshould_increase_count_sequentially_using_panache_and_hr_session()
will occasionally fail - Change dependency to use Hibernate Reactive 2.4.5.Final
- Observe that all tests are successful
Output of uname -a
or ver
No response
Output of java -version
No response
Quarkus version or git rev
3.21.1
Build tool (ie. output of mvnw --version
or gradlew --version
)
No response
Additional information
This behavior can only be reproduced with Hibernate Reactive 2.4.6.Final. Using HR 2.4.5.Final, everything is working as expected.
We suspect that hibernate/hibernate-reactive#2198 might be the root cause, but not quite sure.