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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 4.2.3.SP8, 4.2.3.CP02, 4.4.CR1
    • 4.2.3.SP5, 4.2.3.CP01, 4.3.0.GA
    • JTA, JTS
    • None

      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.

            rhn-engineering-jhallida Jonathan Halliday
            rhn-engineering-jhallida Jonathan Halliday
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: