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

Race condition between thread sending COMPLETE and thread handling NOT_COMPLETED causes error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 4.13.0
    • 4.12.0
    • XTS
    • None

      BA CoordinatorCompletion participants suffer a timeout failure if they call BAParticipantManager.cannotComplete() underneath a call to BAWithCCParticipant.complete(). This problem arises because of a race condition on the coordinator side between the thread sending the COMPLETE request and the thread handling the NOT_COMPLETING response. AN error on the coordinator side means that the participant does not get sent the expected NOT_COMPLETED acknowledgement.

      Here is how it goes worng:

      The sending thread dispatches a COMPLETED message then waits on a change to the coordinator engine state.

      The participant side receives COMPLETED and the participant calls cannotComplete, sending NOT_COMPLETING

      The handler thread is started in response to an incoming NOT_COMPLETING message. The first thing it does is set the coordinator engine state to NOT_COMPLETING.

      Chequered flag raised!

      The sending thread wakes up and finds that the state has transitioned to something other than COMPLETED. If the complete was done as part of a client close request it tries to notify the coordinator to abort

      In the meantime the handler tries to notify the coordinator that the participant cannot complete.

      Chequered flag down!

      If the sender wins the race the handler thread finds an ABORTED coordinator and blows up with a WrongState exception which means it does not send NOT_COMPLETED (also, it does nto clear out the transaction).

      n.b. this is exactly the same problem as was dealt with earlier when fail requests were being sent during COMPLETE/CANCEL/COMPENSATE processing.

            rhn-engineering-adinn Andrew Dinn
            rhn-engineering-adinn Andrew Dinn
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: