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

race condition in XAResource start/end handling due to async rollback

    Details

      Description

      There exists a race condition such that we may call start on an XAResource but never call end (or anything else) on it if the transaction times out whilst the resource enlistment is still in progress. This is a Bad Thing and may make resource managers unhappy.

      To reproduce:

      TransactionManager tm = new TransactionManagerImple();
      tm.setTransactionTimeout(5);
      tm.begin();
      Transaction t = tm.getTransaction();
      // XAResourceImpl has a start method with Thread.sleep longer than 5s
      XAResource xaResource = new XAResourceImpl();
      t.enlistResource(xaResource);
      Thread.sleep(10);
      // reaper times out the tx, resource manager for XAResource
      // may have received start but never receives end.

      Fix notes: TransactionImple.enlistResource needs to lock out the reaper thread. At first glance an alternative fix is to put the resource into the transaction's internal data structure before calling start on it, but that would allow an 'end, begin' sequence of calls to be seen by the resource manager.

      caution: ref support case i-t #171373 there may exist additional race conditions in the app server JCA so this change alone won't necessarily fix the problem.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  jhalliday Jonathan Halliday
                  Reporter:
                  jhalliday Jonathan Halliday
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: