Created attachment 1237094 [details] Reproducer A scenario with a EJB XA transaction between two applications (war). The process is the following: 1. a client GUI is calling a remote EJB on project 1 that initiate the XA transaction. 2. The project 1 call a remote EJB on project 2 that create a new branch in XA transaction 3. the project 2 enlist two XA resources that share the same RMid. 4. EJB call on both project 2 and project 1 and 2PC is initiated by project 1 to commit the XA transaction. The expected behaviour is that "start" and "end" operations are called on both XA resource enlisted in project 2 as mentioned in JTA/XA specifications. How reproducible: Please find attached reproducer.zip Steps to Reproduce: 1) Deploy the 2 wars (project 1 and project 2) in the same Jboss server. 2) Run the GUI client (mvn exec:java in sources files folder) Actual results: following logs shows that "end" method is only called on XAResource 1. 09:18:34,564 INFO { } [stdout] (EJB default - 1) start resource2 xid=< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffac129ea0:6ee503a4:5864c6a7:11, node_name=1, branch_uid=0:ffffac129ea0:6ee503a4:5864c6a7:17, subordinatenodename=null, eis_name=unknown eis name > 09:18:34,565 INFO { } [stdout] (EJB default - 1) end resource1 xid=< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffac129ea0:6ee503a4:5864c6a7:11, node_name=1, branch_uid=0:ffffac129ea0:6ee503a4:5864c6a7:17, subordinatenodename=null, eis_name=unknown eis name > 09:18:34,565 INFO { } [stdout] (EJB default - 1) prepare resource1 xid=< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffac129ea0:6ee503a4:5864c6a7:11, node_name=1, branch_uid=0:ffffac129ea0:6ee503a4:5864c6a7:17, subordinatenodename=null, eis_name=unknown eis name > 09:18:34,574 INFO { } [stdout] (EJB default - 1) commit resource1 xid=< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffac129ea0:6ee503a4:5864c6a7:11, node_name=1, branch_uid=0:ffffac129ea0:6ee503a4:5864c6a7:17, subordinatenodename=null, eis_name=unknown eis name > Expected results is that "start" and "end" operations are called on both XA resource enlisted in project 2 as mentioned in JTA/XA specifications. But the following logs shows that "end" method is only called on XAResource 1. Additional Info: I have consolidated all the wars in folder name reproducer.zip.
Citing Mike Musgrove from the upstream Jira [1]: > After consulting the JTA spec (section 3.3.1 Resource Enlistment of the JTA > spec) I am of the opinion that this is not a bug. > The isSameRM() call is so that a TM can optimise away redundant calls to > start/end (which are expensive). If we have already, in this process, called > end on a XAResource for which isSameRM has returned true then know we do not > need to call end a second time. On the other hand if it were in a different > process then, yes I agree, we would to need to call start/end again. > Also notice that the spec is explicit about the prepare/commit calls in the > sense that it says that prepare/commit calls should not be issued on two > resources that have the same RM (section 3.3.1): > >> ... and ensures that the same resource manager only receives one set of >> prepare-commit calls for completing the target global transaction > [1] https://issues.jboss.org/browse/JBEAP-8088?focusedCommentId=13361072&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13361072
Closing as per engineering response, that this is not a bug according to the specification