[
https://issues.jboss.org/browse/JBJCA-1159?page=com.atlassian.jira.plugin...
]
Shrihari Chakrapani commented on JBJCA-1159:
--------------------------------------------
An example of how acquiring a lock can fail, if a TX timesout
{noformat}
Caused by: java.lang.IllegalStateException: No transaction is running
at
com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple.getTransactionImple(TransactionSynchronizationRegistryImple.java:232)
at
com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple.getResource(TransactionSynchronizationRegistryImple.java:125)
at
org.jboss.jca.core.connectionmanager.pool.AbstractPool.getLock(AbstractPool.java:264)
at
org.jboss.jca.core.connectionmanager.pool.AbstractPool.getTransactionNewConnection(AbstractPool.java:500)
at
org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:374)
at
org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)
at
org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)
at
org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)
at
org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:139)
at
org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:70)
at
org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:292)
at
org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:214)
at
org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:157)
at
org.hibernate.engine.jdbc.internal.StatementPreparerImpl.connection(StatementPreparerImpl.java:56)
at
org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:161)
at
org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:182)
at
org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:159)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1854)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1831)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1811)
at org.hibernate.loader.Loader.doQuery(Loader.java:899)
at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:341)
at org.hibernate.loader.Loader.doList(Loader.java:2516)
at org.hibernate.loader.Loader.doList(Loader.java:2502)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2332)
at org.hibernate.loader.Loader.list(Loader.java:2327)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:490)
at
org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:355)
at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:195)
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1269)
at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:264)
{noformat}
DB Connections leaked if TX is not active after retrieving a
connection
-----------------------------------------------------------------------
Key: JBJCA-1159
URL:
https://issues.jboss.org/browse/JBJCA-1159
Project: IronJacamar
Issue Type: Bug
Components: Core
Affects Versions: 1.0.19.Final
Environment: AS7 EAP6.1
Reporter: gui borland
Assignee: Jesper Pedersen
Priority: Critical
When a connection is retrieved from the MCP, ironjacamar will register it to ongoing JTA
transaction. However, if the ongoing TX is not 'active' anymore the connection is
lost.
The code of AbstractPool demonstrates the problem. The call to getLock will throw an
exception if the current TX is not active anymore and the cl is not returned to the pool.
This issue can be reproduced on AS7 by using any EJB that requires a tx and does
something with a DB connection. Put a breakpoint in the code below after retrieving the
connectionlistener, and then wait for the transaction to timeout. Once that's done,
continue the thread. The connection is not release (can be seen in JMX)
We have noticed this problem regularly during our performance tests.
{code}
ConnectionListener cl = mcp.getConnection(subject, cri);
if (trace)
log.tracef("Got connection from pool tracked by transaction=%s tx=%s",
cl, trackByTransaction);
TransactionSynchronizationRegistry tsr = getTransactionSynchronizationRegistry();
Lock lock = getLock();
try
{
lock.lockInterruptibly();
}
catch (InterruptedException ie)
{
Thread.interrupted();
throw new ResourceException(bundle.unableObtainLock(), ie);
}
{code}
It seems this issue was introduced by changes done for
https://issues.jboss.org/browse/JBJCA-572
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira