activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "anthony.durussel" <anthony.durus...@gmail.com>
Subject [XA] TransactionContext is not cleaned up when session are returned to XaPooledConnectionFactory
Date Thu, 01 Dec 2016 08:34:48 GMT
In a Spring4/EJB3/JBoss EAP 6 environement, 

We got some exceptions 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


    public void cleanup() {
        associatedXid = null;
        transactionId = null;
    }



but this method seems to be never called !

We also discovered that this case happens only when there is two session
used for the same XA transaction. In that case the second session used is
enlisted in the XA transaction with the TMJOIN flag. At the commit time,
only one of the two session has its method "end" called by the XA
transactionManager. Is that behavior the one expected by activeMQ ? 



--
View this message in context: http://activemq.2283324.n4.nabble.com/XA-TransactionContext-is-not-cleaned-up-when-session-are-returned-to-XaPooledConnectionFactory-tp4719663.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Mime
View raw message