[jira] [Commented] (GERONIMO-6543) Aries/Geronimo XA transaction recovery not working for heuristically completed transactions

2015-05-05 Thread David Jencks (JIRA)

[ 
https://issues.apache.org/jira/browse/GERONIMO-6543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14529944#comment-14529944
 ] 

David Jencks commented on GERONIMO-6543:


Your analysis looks reasonable to me.  Is there any chance you would like to 
supply a patch?

 Aries/Geronimo XA transaction recovery not working for heuristically 
 completed transactions
 ---

 Key: GERONIMO-6543
 URL: https://issues.apache.org/jira/browse/GERONIMO-6543
 Project: Geronimo
  Issue Type: Bug
  Security Level: public(Regular issues) 
  Components: transaction manager
 Environment: Apache Karaf 2.3.0, JBoss Fuse 6.1-redhat-610379
Reporter: Jörn Gersdorf
Assignee: Guillaume Nodet

 We´re facing a problem with XA transaction recovery when a resource manager 
 (like in our case Websphere MQ) is reporting heuristically completed 
 transactions. 
 The flow goes like that (see 
 {{org.apache.geronimo.transaction.manager.RecoveryImpl.recoverResourceManager(NamedXAResource)}}):
 • We´re starting JBoss Fuse, data/txlog/* has been deleted before start.
 • {{GenericResourceManager}} is starting recovery
 • The {{NamedXAResourceFactory}} is enlisted
 • Geronimo calls {{xa_recover(TM_STARTRSCAN | TMENDRSCAN)}} on the XA 
 Resource (Websphere MQ)
 • Websphere MQ reports a XID which is to be recovered, Aries TxManager 
 does not know about the XID so it tries to send xa_rollback to MQ
 • MQ already had the XID heuristically rolled back before, so it answers 
 with {{XA_HEURRB (6)}}.
 • Geronimo logs the exception, but does not do anything about it
 Since Geronimo does not do anything about the pending transaction, it stays 
 pending withing Websphere MQ, and the same error will occur upon next restart.
 What´s missing here from our perspective is a call to xa_forget after 
 receiving a XA_HEURB.
 Btw, in {{org.apache.geronimo.transaction.manager.RollbackTask.run()}} 
 {{XA_HEURRB}} seems to be handled correctly by sending an xa_forget.
 Stack trace below.
 We´re using following bundles:
 {noformat}
 [ 281] [Active ] [] [   ] [   50] 
 mvn:org.apache.geronimo.components/geronimo-connector/3.1.1
 [ 116] [Active ] [] [   ] [   30] 
 mvn:org.apache.aries.transaction/org.apache.aries.transaction.manager/1.0.1.redhat-610379
 [ 118] [Active ] [] [   ] [   30] 
 mvn:org.apache.aries.transaction/org.apache.aries.transaction.jdbc/1.0.1.redhat-610379
 [ 569] [Active ] [Created ] [   ] [   50] 
 mvn:org.apache.activemq/activemq-osgi/5.9.0.redhat-610379
 {noformat}
 Looking at the upstream source code the problem exists there, too: 
 https://github.com/apache/geronimo-txmanager/blob/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/RecoveryImpl.java#L127.
 {noformat}
 2015-04-29 11:55:28,184 | TRACE | FelixStartLevel | WrapperNamedXAResource | 
 116  | Recover called on XAResource wmq-wpreconXA
 flags:  TMENDRSCAN TMSTARTRSCAN remaining: 25165824
 2015-04-29 11:55:28,187 | TRACE | FelixStartLevel | WrapperNamedXAResource | 
 116  | Rollback called on XAResource wmq-wpreconXA
 Xid: {JmqiXid@545310144: formatId(4765526f), 
 gtrid(8df91ce04c016f72672e6170616368652e61726965732e7472616e73616374696f6e),
  
 bqual(0100308807e04c016170616368652e61726965732e7472616e73616374696f6e)}
 2015-04-29 11:55:28,190 | ERROR | FelixStartLevel | Recovery | 116  | Could 
 not roll back
 javax.transaction.xa.XAException: Methode 'xa_rollback' ist mit Fehlercode 
 '6' fehlgeschlagen.
 at com.ibm.mq.jmqi.JmqiXAResource.rollback(JmqiXAResource.java:861)
 at 
 org.apache.geronimo.transaction.manager.WrapperNamedXAResource.rollback(WrapperNamedXAResource.java:100)
 at 
 org.apache.geronimo.transaction.manager.RecoveryImpl.recoverResourceManager(RecoveryImpl.java:127)
 at 
 org.apache.geronimo.transaction.manager.RecoverTask.run(RecoverTask.java:52)
 at 
 org.apache.geronimo.transaction.manager.TransactionManagerImpl.registerNamedXAResourceFactory(TransactionManagerImpl.java:353)
 at 
 Proxyc5f66ef2_fefc_4587_80b8_fb531eb6b156.registerNamedXAResourceFactory(Unknown
  Source)
 at 
 org.apache.activemq.jms.pool.GenericResourceManager$Recovery.recover(GenericResourceManager.java:144)
 at 
 org.apache.activemq.jms.pool.GenericResourceManager.recoverResource(GenericResourceManager.java:77)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
 Method)[:1.7.0_45]
 at 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_45]
 at 
 

[jira] [Assigned] (GERONIMO-6543) Aries/Geronimo XA transaction recovery not working for heuristically completed transactions

2015-05-05 Thread Guillaume Nodet (JIRA)

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

Guillaume Nodet reassigned GERONIMO-6543:
-

Assignee: Guillaume Nodet

 Aries/Geronimo XA transaction recovery not working for heuristically 
 completed transactions
 ---

 Key: GERONIMO-6543
 URL: https://issues.apache.org/jira/browse/GERONIMO-6543
 Project: Geronimo
  Issue Type: Bug
  Security Level: public(Regular issues) 
  Components: transaction manager
 Environment: Apache Karaf 2.3.0, JBoss Fuse 6.1-redhat-610379
Reporter: Jörn Gersdorf
Assignee: Guillaume Nodet

 We´re facing a problem with XA transaction recovery when a resource manager 
 (like in our case Websphere MQ) is reporting heuristically completed 
 transactions. 
 The flow goes like that (see 
 {{org.apache.geronimo.transaction.manager.RecoveryImpl.recoverResourceManager(NamedXAResource)}}):
 • We´re starting JBoss Fuse, data/txlog/* has been deleted before start.
 • {{GenericResourceManager}} is starting recovery
 • The {{NamedXAResourceFactory}} is enlisted
 • Geronimo calls {{xa_recover(TM_STARTRSCAN | TMENDRSCAN)}} on the XA 
 Resource (Websphere MQ)
 • Websphere MQ reports a XID which is to be recovered, Aries TxManager 
 does not know about the XID so it tries to send xa_rollback to MQ
 • MQ already had the XID heuristically rolled back before, so it answers 
 with {{XA_HEURRB (6)}}.
 • Geronimo logs the exception, but does not do anything about it
 Since Geronimo does not do anything about the pending transaction, it stays 
 pending withing Websphere MQ, and the same error will occur upon next restart.
 What´s missing here from our perspective is a call to xa_forget after 
 receiving a XA_HEURB.
 Btw, in {{org.apache.geronimo.transaction.manager.RollbackTask.run()}} 
 {{XA_HEURRB}} seems to be handled correctly by sending an xa_forget.
 Stack trace below.
 We´re using following bundles:
 {noformat}
 [ 281] [Active ] [] [   ] [   50] 
 mvn:org.apache.geronimo.components/geronimo-connector/3.1.1
 [ 116] [Active ] [] [   ] [   30] 
 mvn:org.apache.aries.transaction/org.apache.aries.transaction.manager/1.0.1.redhat-610379
 [ 118] [Active ] [] [   ] [   30] 
 mvn:org.apache.aries.transaction/org.apache.aries.transaction.jdbc/1.0.1.redhat-610379
 [ 569] [Active ] [Created ] [   ] [   50] 
 mvn:org.apache.activemq/activemq-osgi/5.9.0.redhat-610379
 {noformat}
 Looking at the upstream source code the problem exists there, too: 
 https://github.com/apache/geronimo-txmanager/blob/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/RecoveryImpl.java#L127.
 {noformat}
 2015-04-29 11:55:28,184 | TRACE | FelixStartLevel | WrapperNamedXAResource | 
 116  | Recover called on XAResource wmq-wpreconXA
 flags:  TMENDRSCAN TMSTARTRSCAN remaining: 25165824
 2015-04-29 11:55:28,187 | TRACE | FelixStartLevel | WrapperNamedXAResource | 
 116  | Rollback called on XAResource wmq-wpreconXA
 Xid: {JmqiXid@545310144: formatId(4765526f), 
 gtrid(8df91ce04c016f72672e6170616368652e61726965732e7472616e73616374696f6e),
  
 bqual(0100308807e04c016170616368652e61726965732e7472616e73616374696f6e)}
 2015-04-29 11:55:28,190 | ERROR | FelixStartLevel | Recovery | 116  | Could 
 not roll back
 javax.transaction.xa.XAException: Methode 'xa_rollback' ist mit Fehlercode 
 '6' fehlgeschlagen.
 at com.ibm.mq.jmqi.JmqiXAResource.rollback(JmqiXAResource.java:861)
 at 
 org.apache.geronimo.transaction.manager.WrapperNamedXAResource.rollback(WrapperNamedXAResource.java:100)
 at 
 org.apache.geronimo.transaction.manager.RecoveryImpl.recoverResourceManager(RecoveryImpl.java:127)
 at 
 org.apache.geronimo.transaction.manager.RecoverTask.run(RecoverTask.java:52)
 at 
 org.apache.geronimo.transaction.manager.TransactionManagerImpl.registerNamedXAResourceFactory(TransactionManagerImpl.java:353)
 at 
 Proxyc5f66ef2_fefc_4587_80b8_fb531eb6b156.registerNamedXAResourceFactory(Unknown
  Source)
 at 
 org.apache.activemq.jms.pool.GenericResourceManager$Recovery.recover(GenericResourceManager.java:144)
 at 
 org.apache.activemq.jms.pool.GenericResourceManager.recoverResource(GenericResourceManager.java:77)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
 Method)[:1.7.0_45]
 at 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_45]
 at 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_45]
 at