Uploaded image for project: 'JBoss Transaction Manager'
  1. JBoss Transaction Manager
  2. JBTM-3148

Remote JTA EJB transaction context propagation fails to correctly run 1PC

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 5.9.6.Final
    • 5.9.5.Final
    • JTA
    • None
    • Hide

      added test case at crashrecovery test suite TxPropagationJMSCrashRecoveryTestCase#commitHaltServerOnePhase and TxPropagationJMSCrashRecoveryTestCase#commitRmfailServerOnePhase

      Show
      added test case at crashrecovery test suite TxPropagationJMSCrashRecoveryTestCase#commitHaltServerOnePhase and TxPropagationJMSCrashRecoveryTestCase#commitRmfailServerOnePhase

    Description

      Remote JTA EJB transaction propagation works with the remote EJB XAResource as with any other resource which is JVM-local. As the first server uses only on participant (the remoting EJB XAResource) then the 1PC. When a failure happens at the remote side during the commit EJB remote XAResource.commit we can't define outcome.

      Consider:

      1. first server calls a second server
      2. the first server uses as the resource only the remote call to the second server
      3. transaction context is propagated and used at the second server
      4. the second server makes some changes in database and sends data to JMS broker (2 {{XAResource}}s)
      5. 1PC is used to run commit on the only XAResource at the first server which is EJB remote XAResource
      6. the second server is called with one phase commit
      7. the calls is transformed to SubordinateAtomicAction#doOnePhaseCommit which runs AtomicAction#End to call 2PC on resources
      8. prepare on database resource and JMS resource is run
      9. commit runs on the database resource, then...
      10. JVM crashes before JMS broker is committed
      11. (or JMS broker is not accessible because because of a networking issue and exception on RA commit is thrown)

      In case of the JVM crash heuristic outcome is saved to the object store at the first server. Administrator is expected to check what happened as the global transaction outcome is unknown. The 1PC doesn't save anything to Narayana object store. The database on the second server was committed while JMS delivery failed to commit.

      The picture at the forum discussion depicts the situation
      https://developer.jboss.org/servlet/JiveServlet/showImage/2-989167-320301/drawio+diagram.png

      Heuristic outcome for remote JTA subordinate 1PC by https://issues.jboss.org/browse/JBTM-2443

      In case of the RA connection failure and in case the RA throws XAException.XAER_RMFAIL (or RETRY) - which is expected outcome when 2PC should be retried with recovery - the remote side obtains error information but 1PC only informs about error but has no record saved in the object store. Thus the transaction record is forgotten.
      That's not right as the JMS RA is held in prepared state. As it's part of the subordinate transaction (at the second server) it will be never finished (responsibility of finishing subordinate transaction is for the parent transaction). As the first server (the parent one) did not save any data there is nobody to finish transaction to commit.

      One option is to force the commit to return heuristic for administrator to finish the doubtful resource. Make it working the same way as the JVM crash scenario works (see above JBTM-2443).
      The other option could be not permitting the 1PC for remote JTA subordinate XAResources at all.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: