Connection leak with lazy load of references and Agroal

Description

When entityManager.getReference() method is invoked, the transaction interceptor (@Transactional) is executed and the commit is done but at this moment without involving any connection to the database.
After that, when a proxy fires a load event, it opens a connection and performs the query, but the close() method is never invoked causing the connection to remain active in the pool and never be released.

I have based my sample on projects of Hibernate repo. Following the example of hibernate-demo (cdi-jpa-testing) I made a sample project with Hibernate 5.4.2/5.4.3 and Agroal (test).
After running into connection leaks with "Arjuna TransactionalDriver", I tried with "hibernate-agroal" but using a custom AgroalConnectionProvider (enabling transaction integration) with same result.

Activity

Show:

Ariel Carrera July 15, 2019 at 1:37 PM

Please close issue

Ariel Carrera July 15, 2019 at 1:34 PM

Tested again with a different cdi configuration and works correctly.

Rejected

Details

Assignee

Reporter

Components

Affects versions

Priority

Created July 1, 2019 at 2:48 PM
Updated July 25, 2019 at 10:12 PM
Resolved July 25, 2019 at 10:12 PM