Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-3200

AMQ returns wrong XA_RETRY XAException error code on connection crash for 1PC

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Blocker
    • 7.0.0.ER7
    • 7.0.0.ER4
    • ActiveMQ
    • None
    • Hide

      Crash recovery testsuite could be used for reproducing this

      git clone git://git.app.eng.bos.redhat.com/jbossqe-eap-tests-transactions.git
      cd eap-tests-scripts
      unignore test haltConnectionOnOnePhaseCommitAfterXACommits in file ./jbossts/src/test/java/org/jboss/as/test/jbossts/crashrec/test/JMSProxyMessagingServerCrashRecoveryTestCase.java
      export JBOSS_HOME=path/to/eap
      mvn clean verify 
      -Dtest=JMSProxyMessagingServerCrashRecoveryTestCase#haltConnectionOnOnePhaseCommitAfterXACommits -Djbossts.noJTS
      
      Show
      Crash recovery testsuite could be used for reproducing this git clone git: //git.app.eng.bos.redhat.com/jbossqe-eap-tests-transactions.git cd eap-tests-scripts unignore test haltConnectionOnOnePhaseCommitAfterXACommits in file ./jbossts/src/test/java/org/jboss/as/test/jbossts/crashrec/test/JMSProxyMessagingServerCrashRecoveryTestCase.java export JBOSS_HOME=path/to/eap mvn clean verify -Dtest=JMSProxyMessagingServerCrashRecoveryTestCase#haltConnectionOnOnePhaseCommitAfterXACommits -Djbossts.noJTS

    Description

      When fail on connection occurs during commit call on AMQ XAResource implmementation then XA_RETRY error code of XAException is returned. This is correct for 2PC but it's not permitted by spec for 1PC.

      The spec says for  xa_commit() case:

      The resource manager is not able to commit the transaction branch at this time.This value may be returned when a blocking condition exists and TMNOWAITwas set. Note, however, that this value may also be returned even whenTMNOWAIT is not set (for example, if the necessary stable storage is currentlyunavailable). This value cannot be returned if TMONEPHASE is set in flags. Allresources held on behalf of ∗xid remain in a prepared state until commitment ispossible. The transaction manager should reissue xa_commit() at a later time.
      

      Please note what is said about one phase commit: This value cannot be returned if TMONEPHASE is set in flags.

      AMQ behavior is currently against XA specification.
      More of this this leads to fact that Narayana TM consider this as rolled backed transaction branch and so client receives `RollbackException` on return. That means that client consider this branch as rolled back.
      This is wrong for case when connection is halt right after the time when JMS server commits its work but this information is not passed back to TM. That leads to fact that transaction is committed on JMS broker side but client is informed that it was rolled back.

      By specification and what Narayana expects the correct return XA error code should be XAER_RMFAIL.

      Attachments

        Issue Links

          Activity

            People

              gaohoward Howard Gao
              ochaloup@redhat.com Ondrej Chaloupka (Inactive)
              Ondrej Chaloupka Ondrej Chaloupka (Inactive)
              Ondrej Chaloupka Ondrej Chaloupka (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: