Uploaded image for project: 'ActiveMQ'
  1. ActiveMQ
  2. AMQ-6508

TransactionContext is not cleaned up when session are returned to XaPooledConnectionFactory

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: 5.12.1
    • Fix Version/s: None
    • Component/s: Pool
    • Labels:
      None

      Description

      In a Spring/EJB/JBoss 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

      TransactionContext.java lines 806-809
          public void cleanup() {
              associatedXid = null;
              transactionId = null;
          }
      

      but this method seems to be never called.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              a.durussel Anthony Durussel
            • Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: