[ 
https://issues.apache.org/jira/browse/AMQ-2191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary Tully reopened AMQ-2191:
-----------------------------
      Assignee: Gary Tully  (was: Rob Davies)

I have come across a similar issue, different TM but that is incidental.
In my case, it is an ack as part of commit that sees the first interrupt. This 
causes a beforecompletion error. However on the rollback, the ack is done/gone 
and the broker side acks are missing so even after the client side rollback, 
the messages remain inflight to the consumer. 
>From what I can see, it is not safe to assume a retry of a commit/rollback op 
>is sufficient.
I think that an InterruptedIOException in the XA case should be reported to the 
exception listener and allow the connection to close, forcing a rollback broker 
side and forcing a rollback client side also.
{code}
2015-08-19 10:17:03,827 WARN [com.arjuna.ats.arjuna] (Transaction Reaper) 
ARJUNA012117: TransactionReaper::check timeout for TX 
0:ffff650182a8:58549259:55d38674:22df0 in state RUN
2015-08-19 10:17:04,065 WARN [com.arjuna.ats.arjuna] (Transaction Reaper) 
ARJUNA012117: TransactionReaper::check timeout for TX 
0:ffff650182a8:58549259:55d38674:22dec in state CANCEL
2015-08-19 10:17:04,328 WARN [com.arjuna.ats.arjuna] (Transaction Reaper) 
ARJUNA012117: TransactionReaper::check timeout for TX 
0:ffff650182a8:58549259:55d38674:22df0 in state SCHEDULE_CANCEL
2015-08-19 10:17:04,488 WARN [com.arjuna.ats.jta] (Transaction Reaper Worker 0) 
ARJUNA016045: attempted rollback of < formatId=131077, gtrid_length=29, 
bqual_length=36, tx_uid=0:ffff650182a8:58549259:55d38674:22dec, node_name=1, 
branch_uid=0:ffff650182a8:58549259:55d38674:22ded, subordinatenodename=null, 
eis_name=unknown eis name > 
(org.apache.activemq.ra.LocalAndXATransaction@3de1f429) failed with exception 
code XAException.XAER_RMFAIL: javax.transaction.xa.XAException: 
java.io.InterruptedIOException
at 
org.apache.activemq.TransactionContext.toXAException(TransactionContext.java:805)
at org.apache.activemq.TransactionContext.rollback(TransactionContext.java:532)
at 
org.apache.activemq.ra.LocalAndXATransaction.rollback(LocalAndXATransaction.java:141)
at 
com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord.topLevelAbort(XAResourceRecord.java:358)
 [jbossjts-jacorb-4.17.7.Final-redhat-4-bz-1023562.jar:4.17.7.Final-redhat-1]
at com.arjuna.ats.arjuna.coordinator.BasicAction.doAbort(BasicAction.java:2853) 
[jbossjts-jacorb-4.17.7.Final-redhat-4-bz-1023562.jar:4.17.7.Final-redhat-1]
at com.arjuna.ats.arjuna.coordinator.BasicAction.doAbort(BasicAction.java:2832) 
[jbossjts-jacorb-4.17.7.Final-redhat-4-bz-1023562.jar:4.17.7.Final-redhat-1]
at com.arjuna.ats.arjuna.coordinator.BasicAction.Abort(BasicAction.java:1625) 
[jbossjts-jacorb-4.17.7.Final-redhat-4-bz-1023562.jar:4.17.7.Final-redhat-1]
at 
com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.cancel(TwoPhaseCoordinator.java:118)
 [jbossjts-jacorb-4.17.7.Final-redhat-4-bz-1023562.jar:4.17.7.Final-redhat-1]
at com.arjuna.ats.arjuna.AtomicAction.cancel(AtomicAction.java:215) 
[jbossjts-jacorb-4.17.7.Final-redhat-4-bz-1023562.jar:4.17.7.Final-redhat-1]
at 
com.arjuna.ats.arjuna.coordinator.TransactionReaper.doCancellations(TransactionReaper.java:370)
 [jbossjts-jacorb-4.17.7.Final-redhat-4-bz-1023562.jar:4.17.7.Final-redhat-1]
at 
com.arjuna.ats.internal.arjuna.coordinator.ReaperWorkerThread.run(ReaperWorkerThread.java:78)
 [jbossjts-jacorb-4.17.7.Final-redhat-4-bz-1023562.jar:4.17.7.Final-redhat-1]
Caused by: javax.jms.JMSException: java.io.InterruptedIOException
at 
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:72)
at 
org.apache.activemq.ActiveMQConnection.doAsyncSendPacket(ActiveMQConnection.java:1323)
at 
org.apache.activemq.ActiveMQConnection.asyncSendPacket(ActiveMQConnection.java:1315)
at 
org.apache.activemq.ActiveMQSession.asyncSendPacket(ActiveMQSession.java:1972)
at org.apache.activemq.ActiveMQSession$5.afterRollback(ActiveMQSession.java:948)
at 
org.apache.activemq.TransactionContext.afterRollback(TransactionContext.java:161)
at org.apache.activemq.TransactionContext.rollback(TransactionContext.java:527)
... 9 more
Caused by: java.io.InterruptedIOException
at 
org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:102)
at org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:68)
at 
org.apache.activemq.transport.ResponseCorrelator.oneway(ResponseCorrelator.java:60)
at 
org.apache.activemq.ActiveMQConnection.doAsyncSendPacket(ActiveMQConnection.java:1321)
... 14 more
2015-08-19 10:17:04,493 WARN [com.arjuna.ats.arjuna] (Transaction Reaper Worker 
0) ARJUNA012091: Top-level abort of action 
0:ffff650182a8:58549259:55d38674:22dec received TwoPhaseOutcome.FINISH_ERROR 
from com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord
2015-08-19 10:17:15,361 WARN [com.arjuna.ats.arjuna] (default-threads - 46) 
ARJUNA012077: Abort called on already aborted atomic action 
0:ffff650182a8:58549259:55d38674:22dec{code}


> Incorrect handling of interruptions during commit or rollback of a transaction
> ------------------------------------------------------------------------------
>
>                 Key: AMQ-2191
>                 URL: https://issues.apache.org/jira/browse/AMQ-2191
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.3.0
>         Environment: Java 1.6.0_02
> Kubuntu Linux  2.6.24-22
> Bitronix Transaction Manager 1.3.2
>            Reporter: Michael Gottschalk
>            Assignee: Gary Tully
>             Fix For: 5.3.1, 5.4.0
>
>         Attachments: ACTIVEMQ-PATCH, activemq_interruption_fix.diff, 
> xa-jms-exception.txt
>
>
> We have a process framework that sends interruptions to threads that should 
> be stopped or paused. Some of these threads interact with ActiveMQ, so 
> interruptions can occur inside ActiveMQ at different points.
> A problem occurs if the interruption is detected in 
> ActiveMQConnection.syncSendPacket during commit or rollback of a transaction. 
> ActiveMQ then throws a JMSException so that it appears to Bitronix as if the 
> XA transaction is in an inconsistent state (see stacktrace in the attached 
> file).
> In our opinion, the interruption should be ignored by ActiveMQ during the 
> critical commit or rollback phase. It is not mandatory that an interruption 
> has an immediate effect. Especially such a non-interruptable step as rollback 
> or commit should be performed even though an interruption occurs.
> I created a patch for the class TransactionContext which, in case of an 
> interruption, resets the interruption state of the thread, retries the 
> syncSendPacket method call and restores the thread's interruption state 
> afterwards. In this manner, no inconsistent state exceptions occur in the 
> transaction manager any longer and interruption is deferred until the 
> commit/rollback has succeeded.



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

Reply via email to