Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-2805

TransactionImpl.prepareResources() votes readonly in error on lastResource commit failure.

    XMLWordPrintable

Details

    Description

      File: jboss-4.0.4RC1-src/transaction/src/main/org/jboss/tm/TransactionImpl.java
      Version: $Revision: 1.35.2.18 $
      Bundle: jboss-4.0.4RC1
      Description:

      lastResource.commit @ line 1717 throws an XAException (see stack trace below),
      the exception is logged (line 1721) but the error code is not set so we end up in the default handler,
      this is fair enough. The JBossLocalXAException should set an errorCode but that is another issue.
      The status of the transaction changes, but the return is still readonly so that status is ignored and set to committed @ line: 358

      I think the code @ line:1750 should be something like @ line 1708:

      if (status == Status.STATUS_PREPARING)
      status = Status.STATUS_PREPARED;
      else
      return false;

      This ensures that a failure to commit will not be treated as readonly and the transaction will be forced to rollback.
      As it is, a failure of the last resource to commit is ignored.

      Note: the exception stack trace is from version 4.0.1. But inspection (and the comments above) show that the same problem exists in 4.0.4RC1.

      2006-02-14 12:06:44,880 WARN [org.jboss.tm.TransactionImpl] XAException: tx=TransactionImpl:XidImpl[FormatId=257,GlobalId=jupiter/16, BranchQual=, localId=16] errorCode=XA_UNKNOWN(0)
      org.jboss.resource.connectionmanager.JBossLocalXAException: could not commit local tx; - nested throwable: (javax.resource.spi.LocalTransactionException: commit failed)
      at org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource.commit(TxConnectionManager.java:702)
      at org.jboss.tm.TransactionImpl$Resource.commit(TransactionImpl.java:2141)
      at org.jboss.tm.TransactionImpl.prepareResources(TransactionImpl.java:1612)
      at org.jboss.tm.TransactionImpl.prepare(TransactionImpl.java:855)
      at org.jboss.tm.TxManager.prepare(TxManager.java:603)
      at com.iona.jca.artix.XATerminatorWrapper.prepare(XATerminatorWrapper.java:54)
      at com.iona.jbus.runtime.transaction.XAResourceWrapper.xaPrepare(XAResourceWrapper.java:56)
      Caused by: javax.resource.spi.LocalTransactionException: commit failed
      at com.iona.jca.artix.LocalTransactionImpl.commit(LocalTransactionImpl.java:98)
      at org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource.commit(TxConnectionManager.java:695)
      ... 6 more

      Attachments

        Activity

          People

            adrian.brock Adrian Brock (Inactive)
            gtully_jira Gary Tully (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: