[jbossts-issues] [JBoss JIRA] (JBTM-3148) Remote JTA EJB transaction context propagation fails to correctly run 1PC

Ondrej Chaloupka (Jira) issues at jboss.org
Tue Jun 4 10:34:00 EDT 2019

     [ https://issues.jboss.org/browse/JBTM-3148?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ondrej Chaloupka updated JBTM-3148:
    Git Pull Request: https://github.com/jbosstm/narayana/pull/1452

> Remote JTA EJB transaction context propagation fails to correctly run 1PC
> -------------------------------------------------------------------------
>                 Key: JBTM-3148
>                 URL: https://issues.jboss.org/browse/JBTM-3148
>             Project: JBoss Transaction Manager
>          Issue Type: Bug
>          Components: JTA
>    Affects Versions: 5.9.5.Final
>            Reporter: Ondrej Chaloupka
>            Assignee: Ondrej Chaloupka
>            Priority: Major
> 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:
> # first server calls a second server
> # the first server uses as the resource only the remote call to the second server
> # transaction context is propagated and used at the second server
> # the second server makes some changes in database and sends data to JMS broker (2 {{XAResource}}s)
> # 1PC is used to run commit on the only XAResource at the first server which is EJB remote {{XAResource}}
> # the second server is called with one phase commit
> # the calls is transformed to {{SubordinateAtomicAction#doOnePhaseCommit}} which runs {{AtomicAction#End}} to call 2PC on resources
> # prepare on database resource and JMS resource is run
> # commit runs on the database resource, then...
> # JVM crashes before JMS broker is committed
> # (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|https://developer.jboss.org/thread/279243] 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.

This message was sent by Atlassian Jira

More information about the jbossts-issues mailing list