This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 281569 - Integration of JPA using transaction-type="JTA" but without EJB container, set-up incomplete commit cleanup
Summary: Integration of JPA using transaction-type="JTA" but without EJB container, se...
Status: CLOSED WORKSFORME
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P2 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-25 15:38 EDT by Sebastien Tardif CLA
Modified: 2022-06-09 10:22 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastien Tardif CLA 2009-06-25 15:38:14 EDT
By default, eclipselink.persistence-context.close-on-commit end-up to be false, so workaroud is to set it to true in persistence.xml

When eclipselink.persistence-context.close-on-commit is false, UnitOfWork so also ClientSession is not cleanup at the end of the rollback/commit via the JTA callback.

Not cleaning up ClientSession means leak of JDBC connection.

Extract from: http://fisheye2.atlassian.com/browse/~raw,r=1257/eclipselink/trunk/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/transaction/AbstractSynchronizationListener.java

public void afterCompletion(Object status) {
...

  // Clean up by releasing the uow and client session
            if (uow.shouldResumeUnitOfWorkOnTransactionCompletion() && getTransactionController().canMergeUnitOfWork_impl(status)){
                uow.synchronizeAndResume();
                uow.setSynchronized(false);
            }else{
                uow.release();
                // Release the session explicitly
                if (getSession().isClientSession() || (getSession().isSessionBroker() && ((SessionBroker)getSession()).isClientSessionBroker())) {
                    getSession().release();
                }
            }
Comment 1 Tom Ware CLA 2009-07-08 13:04:16 EDT
Setting target and priority.  See the following page for details of what these settings mean. http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 2 Andrei Ilitchev CLA 2011-05-02 14:32:24 EDT
JTA connection is not leaked, it's released by 
getSession().releaseJTSConnection();
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:22:04 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink