scalar-labs / btm

JTA Transaction Manager
Apache License 2.0
426 stars 151 forks source link

Is it possible to recover heuristic exception. #96

Closed bhumanvyas closed 5 years ago

bhumanvyas commented 6 years ago

I am seeing below exception when activemq failover to another node (It uses master/slave configuration). Due to this my app is always hold a connection on activemq side and it only get release once the application is restart. Can we recover heuristic exception without starting the application?

ID:[1114926712,globalId=746f6d6361742d646669496e746572666163652d7473740002ffffff9b35cd004cffffffe6,branchId=746f6d6361742d646669496e746572666163652d7473740002ffffff9b35c1e004cffffffe8] failed with: javax.jms.JMSException: Transaction 'XID:[1114926712,globalId=746f6d6361742d646669496e746572666163652d7473740002ffffff9b35cd004cffffffe6,branchId=746f6d6361742d646669496e746572666163652d7473740002ffffff9b35c1e004cffffffe8]' has not been started. xaErrorCode:-4 javax.jms.JMSException: Transaction 'XID:[1114926712,globalId=746f6d6361742d646669496e746572666163652d7473740002ffffff9b35cd004cffffffe6,branchId=746f6d6361742d646669496e746572666163652d7473740002ffffff9b35c1e004cffffffe8]' has not been started. xaErrorCode:-4 at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:54) at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1399) at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1428) at org.apache.activemq.TransactionContext.commit(TransactionContext.java:585) at bitronix.tm.twopc.Committer$CommitJob.commitResource(Committer.java:202) at bitronix.tm.twopc.Committer$CommitJob.execute(Committer.java:191) at bitronix.tm.twopc.executor.Job.run(Job.java:72) at bitronix.tm.twopc.executor.SyncExecutor.submit(SyncExecutor.java:31) at bitronix.tm.twopc.AbstractPhaseEngine.runJobsForPosition(AbstractPhaseEngine.java:121) at bitronix.tm.twopc.AbstractPhaseEngine.executePhase(AbstractPhaseEngine.java:85) at bitronix.tm.twopc.Committer.commit(Committer.java:86) at bitronix.tm.BitronixTransaction.commit(BitronixTransaction.java:289) at bitronix.tm.BitronixTransactionManager.commit(BitronixTransactionManager.java:143) at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1021) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:761) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:247) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1150) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1142) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1039) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724) Caused by: javax.transaction.xa.XAException: Transaction 'XID:[1114926712,globalId=746f6d6361742d646669496e746572666163652d7473740002ffffff9b35cd004cffffffe6,branchId=746f6d6361742d646669496e746572666163652d7473740002ffffff9b35c1e004cffffffe8]' has not been started. xaErrorCode:-4 at org.apache.activemq.transaction.XATransaction.newXAException(XATransaction.java:174) at org.apache.activemq.broker.TransactionBroker.getTransaction(TransactionBroker.java:351) at org.apache.activemq.broker.TransactionBroker.commitTransaction(TransactionBroker.java:251) at org.apache.activemq.broker.MutableBrokerFilter.commitTransaction(MutableBrokerFilter.java:118) at org.apache.activemq.broker.MutableBrokerFilter.commitTransaction(MutableBrokerFilter.java:118) at org.apache.activemq.broker.TransportConnection.processCommitTransactionTwoPhase(TransportConnection.java:513) at org.apache.activemq.command.TransactionInfo.visit(TransactionInfo.java:102) at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:339) at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:188) at org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50) at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113) at org.apache.activemq.transport.AbstractInactivityMonitor.onCommand(AbstractInactivityMonitor.java:300) at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83) at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:233) at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:215) at java.lang.Thread.run(Thread.java:745)

2018-07-29 19:44:34,295 [Camel (camel-1) thread #7 - JmsConsumer[Consumer.abc.VirtualTopic.txn]] ERROR tm.twopc.AbstractPhaseEngine resource jms/InterfaceCF failed on a Bitronix XID [746F6D6361742D646669496E746572666163652D747374000000029B350C0D00004CE6 : 746F6D6361742D646669496E746572666163652D747374000000029B350C1E00004CE8] bitronix.tm.internal.BitronixXAException: unknown heuristic termination, global state of this transaction is unknown - guilty: an XAResourceHolderState with uniqueName=jms/InterfaceCF XAResource=TransactionContext{transactionId=null,connection=ActiveMQConnection {id=ID:rm-01.cac.com-44938-1532907141544-1:30,clientId=ID:rm-01.cac.com-44938-1532907141544-0:30,started=true}} (ended) with XID a Bitronix XID [746F6D6361742D646669496E746572666163652D747374000000029B350C0D00004CE6 : 746F6D6361742D646669496E746572666163652D747374000000029B350C1E00004CE8]