You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by gastonscapusio <do...@hotmail.com> on 2013/07/15 22:10:38 UTC

ActiveMQ XA JBoss 6.1 problem

Hi,
We have some XA problems using ActiveMQ ra within Jboss 6.1 (tested in v5.6,
v5.7 and v5.8 with the same result).
The ActiveMQ is working in standalone mode (outside jboss).
There are two resources involved in the transaction (activemq and db), both
definied as xa resources.

ActiveMQ does a trx commit when there is a transaction timeout
(/EJBTransactionRolledbackException/). In this way we are losing messages
when there is any timeout.
We have seen that the activemq connections are enlist in XA.
The attribute /transactionContext/ from /ActiveMQSession/ class has the
global transaction reference (xid) before calling the MDB
(/messageListener.onMessage(message)/).
When the timeout is reached and the RuntimeException is throwned, the
transactionContext losed the xid reference.
Later, when ActiveMQSession call the method
/transactionContext.isInXATransaction()/ the result is false because there
is no xid reference.

This situation only happened when the MDB calls other EJB (Stateless) with
CMT - /TransactionAttributeType.REQUIRES_NEW/, and the exception is throwed
inside the Stateless.

Any ideas?

Regards,
Gaston



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-XA-JBoss-6-1-problem-tp4669324.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: ActiveMQ XA JBoss 6.1 problem

Posted by Gary Tully <ga...@gmail.com>.
btw: in the jboss logs or on the console, do you see:
.... WARN  [org.apache.activemq.ra.ServerSessionImpl:0]
(default-threads - 2) Local transaction had not been commited.
Commiting now.



On 15 July 2013 21:10, gastonscapusio <do...@hotmail.com> wrote:
> Hi,
> We have some XA problems using ActiveMQ ra within Jboss 6.1 (tested in v5.6,
> v5.7 and v5.8 with the same result).
> The ActiveMQ is working in standalone mode (outside jboss).
> There are two resources involved in the transaction (activemq and db), both
> definied as xa resources.
>
> ActiveMQ does a trx commit when there is a transaction timeout
> (/EJBTransactionRolledbackException/). In this way we are losing messages
> when there is any timeout.
> We have seen that the activemq connections are enlist in XA.
> The attribute /transactionContext/ from /ActiveMQSession/ class has the
> global transaction reference (xid) before calling the MDB
> (/messageListener.onMessage(message)/).
> When the timeout is reached and the RuntimeException is throwned, the
> transactionContext losed the xid reference.
> Later, when ActiveMQSession call the method
> /transactionContext.isInXATransaction()/ the result is false because there
> is no xid reference.
>
> This situation only happened when the MDB calls other EJB (Stateless) with
> CMT - /TransactionAttributeType.REQUIRES_NEW/, and the exception is throwed
> inside the Stateless.
>
> Any ideas?
>
> Regards,
> Gaston
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-XA-JBoss-6-1-problem-tp4669324.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
http://redhat.com
http://blog.garytully.com

Re: ActiveMQ XA JBoss 6.1 problem

Posted by gastonscapusio <do...@hotmail.com>.
Issue: https://issues.apache.org/jira/browse/AMQ-4634
Resolved



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-XA-JBoss-6-1-problem-tp4669324p4669473.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: ActiveMQ XA JBoss 6.1 problem

Posted by gastonscapusio <do...@hotmail.com>.
ActiveMQSession creates a new local transaction because there isn't an XA trx
in the trasactioncontext.

Logs:
/09:22:32,326 DEBUG [org.apache.activemq.TransactionContext] Start: <
formatId=131076, gtrid_length=29, bqual_length=28,
tx_uid=0:ffffc0a80ad8:126a:51e5393b:43, node_name=1,
branch_uid=0:ffffc0a80ad8:126a:51e5393b:45, eis_name=unknown eis name >
09:22:32,330 DEBUG [org.apache.activemq.TransactionContext] Started XA
transaction:
XID:[globalId=0000000000ffffffffffffffffffffffc0ffffffa8affffffd800126a51ffffffe5393b0004331,branchId=0000000000ffffffffffffffffffffffc0ffffffa8affffffd800126a51ffffffe5393b00045]
09:22:32,335 DEBUG [org.apache.activemq.TransactionContext] End: <
formatId=131076, gtrid_length=29, bqual_length=28,
tx_uid=0:ffffc0a80ad8:126a:51e5393b:43, node_name=1,
branch_uid=0:ffffc0a80ad8:126a:51e5393b:45, eis_name=unknown eis name >
09:22:32,336 DEBUG [org.apache.activemq.TransactionContext] Ended XA
transaction:
XID:[globalId=0000000000ffffffffffffffffffffffc0ffffffa8affffffd800126a51ffffffe5393b0004331,branchId=0000000000ffffffffffffffffffffffc0ffffffa8affffffd800126a51ffffffe5393b00045]
09:22:32,337 DEBUG [org.apache.activemq.TransactionContext] Commit: <
formatId=131076, gtrid_length=29, bqual_length=28,
tx_uid=0:ffffc0a80ad8:126a:51e5393b:43, node_name=1,
branch_uid=0:ffffc0a80ad8:126a:51e5393b:45, eis_name=unknown eis name >,
onePhase=true
09:22:32,383 DEBUG [org.apache.activemq.ra.ServerSessionPoolImpl]
ServerSession requested.
09:22:32,384 DEBUG [org.apache.activemq.ra.ServerSessionPoolImpl] Created a
new session: ServerSessionImpl:2
09:22:32,384 DEBUG [org.apache.activemq.ra.ServerSessionImpl:2] Starting
run.
09:22:32,384 DEBUG [org.apache.activemq.ra.ServerSessionImpl:2] Work
accepted:
javax.resource.spi.work.WorkEvent[source=org.jboss.resource.work.JBossWorkManager@155d786]
09:22:32,384 DEBUG [org.apache.activemq.ra.ServerSessionImpl:2] Work
started:
javax.resource.spi.work.WorkEvent[source=org.jboss.resource.work.JBossWorkManager@155d786]
09:22:32,386 DEBUG [org.apache.activemq.ra.ServerSessionImpl:2] Running
09:22:32,387 DEBUG [org.apache.activemq.ra.ServerSessionImpl:2] run loop
start
09:22:32,387 DEBUG [org.apache.activemq.TransactionContext] Start: <
formatId=131076, gtrid_length=29, bqual_length=28,
tx_uid=0:ffffc0a80ad8:126a:51e5393b:48, node_name=1,
branch_uid=0:ffffc0a80ad8:126a:51e5393b:49, eis_name=unknown eis name >
09:22:32,388 DEBUG [org.apache.activemq.TransactionContext] Started XA
transaction:
XID:[globalId=0000000000ffffffffffffffffffffffc0ffffffa8affffffd800126a51ffffffe5393b0004831,branchId=0000000000ffffffffffffffffffffffc0ffffffa8affffffd800126a51ffffffe5393b00049]
09:23:32,389 DEBUG [org.apache.activemq.TransactionContext] End: <
formatId=131076, gtrid_length=29, bqual_length=28,
tx_uid=0:ffffc0a80ad8:126a:51e5393b:48, node_name=1,
branch_uid=0:ffffc0a80ad8:126a:51e5393b:49, eis_name=unknown eis name >
09:23:32,390 DEBUG [org.apache.activemq.TransactionContext] Ended XA
transaction:
XID:[globalId=0000000000ffffffffffffffffffffffc0ffffffa8affffffd800126a51ffffffe5393b0004831,branchId=0000000000ffffffffffffffffffffffc0ffffffa8affffffd800126a51ffffffe5393b00049]
09:23:32,390 DEBUG [org.apache.activemq.TransactionContext] Rollback: <
formatId=131076, gtrid_length=29, bqual_length=28,
tx_uid=0:ffffc0a80ad8:126a:51e5393b:48, node_name=1,
branch_uid=0:ffffc0a80ad8:126a:51e5393b:49, eis_name=unknown eis name >
09:23:54,877 ERROR [org.jboss.ejb3.tx2.impl.CMTTxInterceptor]
javax.ejb.EJBTransactionRolledbackException
09:24:15,113 ERROR [org.apache.activemq.ActiveMQSession] error dispatching
message: : javax.ejb.EJBTransactionRolledbackException
09:24:16,919 DEBUG [org.apache.activemq.ActiveMQConnection] Async client
internal exception occurred with no exception listener registered:
javax.ejb.EJBTransactionRolledbackException:
javax.ejb.EJBTransactionRolledbackException
*09:24:46,911 DEBUG [org.apache.activemq.TransactionContext]
Begin:TX:ID:gbourrec.tallion.com.ar-58450-1373976924480-23:1:3*
*09:25:05,546 WARN  [org.apache.activemq.ra.ServerSessionImpl:2] Local
transaction had not been commited. Commiting now.*
09:25:05,547 DEBUG [org.apache.activemq.ActiveMQSession]
ID:gbourrec.tallion.com.ar-58450-1373976924480-23:1:3 Transaction Commit
:TX:ID:gbourrec.tallion.com.ar-58450-1373976924480-23:1:3
09:25:05,548 DEBUG [org.apache.activemq.TransactionContext] Commit:
TX:ID:gbourrec.tallion.com.ar-58450-1373976924480-23:1:3 syncCount: 1
09:25:09,879 DEBUG [org.apache.activemq.ra.ServerSessionImpl:2] Endpoint
failed to process message.: java.lang.RuntimeException: Endpoint after
delivery notification failure
	at
org.apache.activemq.ra.ServerSessionImpl.afterDelivery(ServerSessionImpl.java:226)
[:5.6.0]
	at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:915)
[:5.6.0]
	at org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:169)
[:5.6.0]
	at org.jboss.resource.work.WorkWrapper.run(WorkWrapper.java:172)
[:6.1.0.Final]
	at
org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33)
[:2.0.0.CR7]
	at org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:801)
[:2.0.0.CR7]
	at org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:45)
[:2.0.0.CR7]
	at org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:821)
[:2.0.0.CR7]
	at java.lang.Thread.run(Thread.java:662) [:1.6.0_31]
	at org.jboss.threads.JBossThread.run(JBossThread.java:122) [:2.0.0.CR7]
Caused by: javax.resource.ResourceException:
javax.transaction.RollbackException: ARJUNA-16063 The transaction is not
active!
	at
org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.after(MessageInflowLocalProxy.java:263)
[:1.7.21]
	at
org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:140)
[:1.7.21]
	at $Proxy489.afterDelivery(Unknown Source)	at
org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.afterDelivery(MessageEndpointProxy.java:128)
[:5.6.0]
	at
org.apache.activemq.ra.MessageEndpointProxy.afterDelivery(MessageEndpointProxy.java:69)
[:5.6.0]
	at
org.apache.activemq.ra.ServerSessionImpl.afterDelivery(ServerSessionImpl.java:224)
[:5.6.0]
	... 9 more
Caused by: javax.transaction.RollbackException: ARJUNA-16063 The transaction
is not active!
	at
com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1148)
[:6.1.0.Final]
	at
com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:119)
[:6.1.0.Final]
	at
com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
[:6.1.0.Final]
	at
org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.endTransaction(MessageInflowLocalProxy.java:464)
[:1.7.21]
	at
org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.finish(MessageInflowLocalProxy.java:343)
[:1.7.21]
	at
org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.after(MessageInflowLocalProxy.java:259)
[:1.7.21]
	... 14 more

09:25:09,880 DEBUG [org.apache.activemq.ra.ServerSessionImpl:2] run loop end
09:25:09,880 DEBUG [org.apache.activemq.ra.ServerSessionImpl:2] Endpoint did
not release properly: null:
org.apache.activemq.ra.InvalidMessageEndpointException
	at
org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointDead.release(MessageEndpointProxy.java:159)
[:5.6.0]
	at
org.apache.activemq.ra.MessageEndpointProxy.release(MessageEndpointProxy.java:74)
[:5.6.0]
	at
org.apache.activemq.ra.ServerSessionImpl.close(ServerSessionImpl.java:263)
[:5.6.0]
	at
org.apache.activemq.ra.ServerSessionPoolImpl.removeFromPool(ServerSessionPoolImpl.java:230)
[:5.6.0]
	at org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:188)
[:5.6.0]
	at org.jboss.resource.work.WorkWrapper.run(WorkWrapper.java:172)
[:6.1.0.Final]
	at
org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33)
[:2.0.0.CR7]
	at org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:801)
[:2.0.0.CR7]
	at org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:45)
[:2.0.0.CR7]
	at org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:821)
[:2.0.0.CR7]
	at java.lang.Thread.run(Thread.java:662) [:1.6.0_31]
	at org.jboss.threads.JBossThread.run(JBossThread.java:122) [:2.0.0.CR7]

09:25:09,883 DEBUG [org.apache.activemq.ra.ServerSessionImpl:2] Run finished
09:25:09,883 DEBUG [org.apache.activemq.ra.ServerSessionImpl:2] release
called
09:25:09,883 DEBUG [org.apache.activemq.ra.ServerSessionImpl:2] Work
completed:
javax.resource.spi.work.WorkEvent[source=org.jboss.resource.work.JBossWorkManager@155d786]
/



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-XA-JBoss-6-1-problem-tp4669324p4669353.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: ActiveMQ XA JBoss 6.1 problem

Posted by gastonscapusio <do...@hotmail.com>.
I've tried to reproduce this without calling the stateless ejb but it works
well.
The ActiveMQSession class should retain the original transactionContext, as
you mentioned.
I'll create an issue.



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-XA-JBoss-6-1-problem-tp4669324p4669348.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: ActiveMQ XA JBoss 6.1 problem

Posted by Gary Tully <ga...@gmail.com>.
this is a bug for sure. I came across the same thing yesterday and am
investigating. I think the problem can also happen independent of the
call to a stateless ejb. It is an issue with the session auto ack
level and the absence of a transaction context after an abort due to a
timeout.
It looks like we need to retain the transaction context state in the
cmt case until the message dispatch is complete.
Can you raise a jira issue with your test case to capture your
findings. It will provide some validation for any potential fix.

On 15 July 2013 21:10, gastonscapusio <do...@hotmail.com> wrote:
> Hi,
> We have some XA problems using ActiveMQ ra within Jboss 6.1 (tested in v5.6,
> v5.7 and v5.8 with the same result).
> The ActiveMQ is working in standalone mode (outside jboss).
> There are two resources involved in the transaction (activemq and db), both
> definied as xa resources.
>
> ActiveMQ does a trx commit when there is a transaction timeout
> (/EJBTransactionRolledbackException/). In this way we are losing messages
> when there is any timeout.
> We have seen that the activemq connections are enlist in XA.
> The attribute /transactionContext/ from /ActiveMQSession/ class has the
> global transaction reference (xid) before calling the MDB
> (/messageListener.onMessage(message)/).
> When the timeout is reached and the RuntimeException is throwned, the
> transactionContext losed the xid reference.
> Later, when ActiveMQSession call the method
> /transactionContext.isInXATransaction()/ the result is false because there
> is no xid reference.
>
> This situation only happened when the MDB calls other EJB (Stateless) with
> CMT - /TransactionAttributeType.REQUIRES_NEW/, and the exception is throwed
> inside the Stateless.
>
> Any ideas?
>
> Regards,
> Gaston
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-XA-JBoss-6-1-problem-tp4669324.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
http://redhat.com
http://blog.garytully.com