Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Acquisition of multiple connections for schema management #1909

Closed
yrodiere opened this issue May 15, 2024 · 0 comments · Fixed by #1928
Closed

Acquisition of multiple connections for schema management #1909

yrodiere opened this issue May 15, 2024 · 0 comments · Fixed by #1928
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@yrodiere
Copy link
Member

Hibernate Reactive seems to acquire several connections for schema management, which can lead to deadlocks in some extreme situations (small connection pool, multiple schema management running concurrently on the same pool).

See quarkusio/quarkus#39930 (comment)

We could fix it by avoiding the use of multiple concurrent transactions in schema update script generation in Hibernate ORM and/or Hibernate Reactive.
For Hibernate Reactive, weirdly it seems to acquire a connection to then immediately ignore it and acquire a second one from the pool in selectJdbcOutsideTransaction. That's probably a bug @DavideD , isn't it? At the very least I'd expect the first connection not to be acquired.

DavideD added a commit to DavideD/hibernate-reactive that referenced this issue May 27, 2024
DavideD added a commit to DavideD/hibernate-reactive that referenced this issue May 27, 2024
DavideD added a commit to DavideD/hibernate-reactive that referenced this issue May 27, 2024
DavideD added a commit to DavideD/hibernate-reactive that referenced this issue May 27, 2024
DavideD added a commit to DavideD/hibernate-reactive that referenced this issue May 29, 2024
DavideD added a commit to DavideD/hibernate-reactive that referenced this issue May 29, 2024
* Format code
* Remove unnecessary `throws SqlClientException`
DavideD added a commit to DavideD/hibernate-reactive that referenced this issue May 29, 2024
Before we were creating a connection and then ignoring it for each
query required to update the schema or collect metatada.

Now the method for running queries outside the "current" transaction
is in the SqlClientPool.

Note that nowdays it might not be necessary to run these queries
in a separate transaction, but it simplify the code quite a bit
and it's consistent to what we were doing before.
DavideD added a commit to DavideD/hibernate-reactive that referenced this issue May 29, 2024
Before we were creating a connection and then ignoring it for each
query required to update the schema or collect metatada.

Now the method for running queries outside the "current" transaction
is in the SqlClientPool.

Note that nowdays it might not be necessary to run these queries
in a separate transaction, but it simplify the code quite a bit
and it's consistent to what we were doing before.
DavideD added a commit to DavideD/hibernate-reactive that referenced this issue May 29, 2024
Before we were creating a connection and then ignoring it for each
query required to update the schema or collect metatada.

Now the method for running queries outside the "current" transaction
is in the SqlClientPool.
@DavideD DavideD self-assigned this May 29, 2024
@DavideD DavideD added this to the 2.3.2.Final milestone May 29, 2024
@DavideD DavideD added bug Something isn't working enhancement New feature or request and removed bug Something isn't working labels May 29, 2024
DavideD added a commit to DavideD/hibernate-reactive that referenced this issue May 29, 2024
Before we were creating a connection and then ignoring it for each
query required to update the schema or collect metatada.

Now the method for running queries outside the "current" transaction
is in the SqlClientPool.
yrodiere pushed a commit that referenced this issue Jun 3, 2024
yrodiere pushed a commit that referenced this issue Jun 3, 2024
* Format code
* Remove unnecessary `throws SqlClientException`
yrodiere pushed a commit that referenced this issue Jun 3, 2024
Before we were creating a connection and then ignoring it for each
query required to update the schema or collect metatada.

Now the method for running queries outside the "current" transaction
is in the SqlClientPool.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants