You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Jean-Louis MONTEIRO (JIRA)" <ji...@apache.org> on 2009/12/31 11:44:30 UTC

[jira] Commented: (OPENEJB-996) JDBC connection are not released correctly with intra VM Open EJB

    [ https://issues.apache.org/jira/browse/OPENEJB-996?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12795584#action_12795584 ] 

Jean-Louis MONTEIRO commented on OPENEJB-996:
---------------------------------------------

Vincent,

i did some more tests with your sample.
regardless the logging issue (OPENEJB-950) fixed in 3.1.1, there is no other OpenEJB related issue with connection leak.
Setting or not the property System.setProperty("openejb.logger.external", "true"); does not change anything except that when it's set to true, you are not able to see the exception.

By the way, when you say the test is too much slower, it's directly link with the DBCP parameter p.put("movieDatabase.MaxWait", 10000);
If you change the value to 20000, it gonna last more or less 20s.

IMHO, it's an OpenJPA issue which does not release the connection. I tried with Hibernate and it works fine.
You can achieve the same kind of behavior adding the property <property name="openjpa.ConnectionRetainMode" value="transaction"/> to your persistence.xml file.

Here is a link to the documentation.
http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manual/ref_guide_dbsetup_retain.html

Gonna send this issue to the OpenJPA user@list.




> JDBC connection are not released correctly with intra VM Open EJB
> -----------------------------------------------------------------
>
>                 Key: OPENEJB-996
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-996
>             Project: OpenEJB
>          Issue Type: Bug
>    Affects Versions: 3.1
>         Environment: maven 2.0.9, EJB3, Windows 2000, Eclipse 3.4.1, Maven Integration For Eclipse 0.9.6
>            Reporter: Vincent MATHON
>         Attachments: OpenEJBBUG.zip
>
>
> I have built a Junit test case from The movies OpenEJB example.
> I have two SLSB with Required Tx. I have configured a pool with only 1 instance to obtain predictive behaviour.
> The first SLSB save an entity (a movie) without throwing exception whereas the second always throw a triggered exception after persisting the movie (this is an ApplicationException with rollback=true but I can reproduce the bug with a RuntimeException too).
> I can run five times (and more) the first SLSB without any problem. When I run twice the second SLSB I obtain the following exception:
> #########################################################################################
> ############################# WITHOUT EXCEPTION #########################################
> #########################################################################################
> ############################# FIRST RUN ... #############################################
> ############################# SECOND RUN ... #############################################
> ############################# THIRD RUN ... #############################################
> ############################# FOURTH RUN ... #############################################
> ############################# FIFTH RUN ... #############################################
> #########################################################################################
> ############################# WITH EXCEPTION ############################################
> #########################################################################################
> ############################# FIRST RUN ... #############################################
> ############################# SECOND RUN (Should Block) ... #############################
> WARN - Unexpected exception from beforeCompletion; transaction will roll back
> <openjpa-1.1.0-r422266:659716 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: Unable to acquire a new connection from the pool
> 	at org.apache.openjpa.jdbc.sql.SQLExceptions.narrow(SQLExceptions.java:146)
> 	at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4150)
> 	at org.apache.openjpa.jdbc.sql.HSQLDictionary.newStoreException(HSQLDictionary.java:292)
> 	at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:102)
> 	at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:88)
> 	at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:64)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.connect(JDBCStoreManager.java:762)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.retainConnection(JDBCStoreManager.java:201)
> 	at org.apache.openjpa.kernel.DelegatingStoreManager.retainConnection(DelegatingStoreManager.java:163)
> 	at org.apache.openjpa.kernel.BrokerImpl.retainConnection(BrokerImpl.java:3700)
> 	at org.apache.openjpa.kernel.BrokerImpl.beginStoreManagerTransaction(BrokerImpl.java:1280)
> 	at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1965)
> 	at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1905)
> 	at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1823)
> 	at org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:515)
> 	at org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:500)
> 	at org.apache.geronimo.transaction.manager.TransactionImpl.rollback(TransactionImpl.java:473)
> 	at org.apache.geronimo.transaction.manager.TransactionManagerImpl.rollback(TransactionManagerImpl.java:258)
> 	at org.apache.openejb.core.transaction.JtaTransactionPolicy.rollbackTransaction(JtaTransactionPolicy.java:333)
> 	at org.apache.openejb.core.transaction.JtaTransactionPolicy.completeTransaction(JtaTransactionPolicy.java:283)
> 	at org.apache.openejb.core.transaction.TxRequired.commit(TxRequired.java:71)
> 	at org.apache.openejb.core.transaction.EjbTransactionUtil.afterInvoke(EjbTransactionUtil.java:74)
> 	at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:231)
> 	at org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:169)
> 	at org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:217)
> 	at org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:77)
> 	at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:286)
> 	at $Proxy23.addMovie(Unknown Source)
> 	at org.superbiz.injection.tx.MoviesTest.testConnectionUnreleasedCorrectlyWhenExceptionIsThrown(MoviesTest.java:114)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:168)
> 	at junit.framework.TestCase.runBare(TestCase.java:134)
> 	at junit.framework.TestResult$1.protect(TestResult.java:110)
> 	at junit.framework.TestResult.runProtected(TestResult.java:128)
> 	at junit.framework.TestResult.run(TestResult.java:113)
> 	at junit.framework.TestCase.run(TestCase.java:124)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:232)
> 	at junit.framework.TestSuite.run(TestSuite.java:227)
> 	at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
> 	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
> 	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
> 	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:165)
> 	at org.apache.maven.surefire.Surefire.run(Surefire.java:107)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:289)
> 	at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:993)
> Caused by: java.sql.SQLException: Unable to acquire a new connection from the pool
> 	at org.apache.commons.dbcp.managed.ManagedConnection.updateTransactionStatus(ManagedConnection.java:120)
> 	at org.apache.commons.dbcp.managed.ManagedConnection.<init>(ManagedConnection.java:55)
> 	at org.apache.commons.dbcp.managed.ManagedDataSource.getConnection(ManagedDataSource.java:77)
> 	at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:884)
> 	at org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:106)
> 	at org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:87)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.connectInternal(JDBCStoreManager.java:773)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.connect(JDBCStoreManager.java:758)
> 	... 45 more
> Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
> 	at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:825)
> 	at org.apache.commons.dbcp.managed.ManagedConnection.updateTransactionStatus(ManagedConnection.java:117)
> 	... 52 more
> So, the JDBC connection is not released correctly. It might be related to OPENEJB-953.
> Vincent

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.