Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-3465

TransactionContext produces errors in concurrent environment

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.5.0
    • 5.6.0
    • Broker
    • None
    • Windows XP SP2, Oracle JDK 1.6.0_23

    Description

      Method "isInXATransaction" of class org.apache.activemq.TransactionContext seems to be implemeted incorrectly. Here is the code:

      public boolean isInXATransaction() {
      return (transactionId != null && transactionId.isXATransaction()) || !ENDED_XA_TRANSACTION_CONTEXTS.isEmpty();
      }

      Map "ENDED_XA_TRANSACTION_CONTEXTS" is a static field. TransactionContext instances are used for both outbound and inbound communications. Suppose a thread creating a new non-transactional session. It calls isInXATransaction and gets true, just because another thread is completing transactional message delivery at the same time. After XAResource.end() call but before XAResource.commit() call the map is not empty and it results in a JMSException in the first thread (see org.apache.activemq.ra.ManagedTransactionContext.setUseSharedTxContext(boolean)").

      Attachments

        Issue Links

          Activity

            People

              tabish Timothy A. Bish
              a.a.akimov Alexei Akimov
              Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: