You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Anthony Durussel (JIRA)" <ji...@apache.org> on 2016/11/17 11:41:59 UTC

[jira] [Created] (AMQ-6508) TransactionContext is not cleaned up when session are returned to XaPooledConnectionFactory

Anthony Durussel created AMQ-6508:
-------------------------------------

             Summary: TransactionContext is not cleaned up when session are returned to XaPooledConnectionFactory
                 Key: AMQ-6508
                 URL: https://issues.apache.org/jira/browse/AMQ-6508
             Project: ActiveMQ
          Issue Type: Bug
          Components: activemq-pool
    Affects Versions: 5.12.1
            Reporter: Anthony Durussel
            Priority: Critical


We got some exception in TransactionContext start method saying that the xaResource is already attributed to an existing XID. 

TransactionImple.enlistResource - xa_start  - caught: XAException.XAER_PROTO for < formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffac129ea0:4eace372:582d9605:4b, node_name=1, branch_uid=0:ffffac129ea0:4eace372:582d9605:55, subordinatenodename=null, eis_name=unknown eis name >: javax.transaction.xa.XAException
	at org.apache.activemq.TransactionContext.start(TransactionContext.java:354) [activemq-client-5.12.1.jar:5.12.1]
	at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:725) [jbossjts-jacorb-4.17.30.Final-redhat-1.jar:4.17.30.Final-redhat-1]
	at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:407) [jbossjts-jacorb-4.17.30.Final-redhat-1.jar:4.17.30.Final-redhat-1]
	at org.apache.activemq.jms.pool.XaConnectionPool.createSession(XaConnectionPool.java:70) [activemq-jms-pool-5.12.1.jar:5.12.1]
	at org.apache.activemq.jms.pool.PooledConnection.createSession(PooledConnection.java:167) [activemq-jms-pool-5.12.1.jar:5.12.1]
	at org.springframework.jms.support.JmsAccessor.createSession(JmsAccessor.java:192) [spring-jms-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.jms.core.JmsTemplate.access$700(JmsTemplate.java:90) [spring-jms-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.jms.core.JmsTemplate$JmsTemplateResourceFactory.createSession(JmsTemplate.java:1211) [spring-jms-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.jms.connection.ConnectionFactoryUtils.doGetTransactionalSession(ConnectionFactoryUtils.java:315) [spring-jms-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:481) [spring-jms-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:580) [spring-jms-4.2.3.RELEASE.jar:4.2.3.RELEASE]
	at ch.rp.commons.jms.MessageSenderServiceImpl.sendTextMessage(MessageSenderServiceImpl.java:30) [rp-commons-jms-0.0.11.jar:]
	at ch.rp.jboss.test.project2.Service2Impl.postJMSMessage(Service2Impl.java:129) [classes:]
	at ch.rp.jboss.test.project2.Service2Impl.insertRowAndPostJms(Service2Impl.java:76) [classes:]
	at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source) [:1.8.0_101]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_101]
	at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_101]

After trying to find out what was the problem, we figured out that some session that are returned to the XAPool are not properly cleaned up and returns to the pool with registered Xid.
As soon as they are reused the above exception is thrown.

Why is the transactionContext not cleaned or at least validate when session is borrow from the pool ? to ensure that the state is valid for the future use.

There is a cleanup method in TransactionContext.java class that reset the registered transaction

line 806-809 
    public void cleanup() {
        associatedXid = null;
        transactionId = null;
    }



but this method seems to be never called.





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)