[jbossts-issues] [JBoss JIRA] Created: (JBTM-792) Race condition between thread sending COMPLETE and thread handling NOT_COMPLETED causes error

Andrew Dinn (JIRA) jira-events at lists.jboss.org
Wed Sep 22 10:00:29 EDT 2010

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

                 Key: JBTM-792
                 URL: https://jira.jboss.org/browse/JBTM-792
             Project: JBoss Transaction Manager
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: XTS
    Affects Versions: 4.12.0
            Reporter: Andrew Dinn
            Assignee: Andrew Dinn
             Fix For: 4.13.0

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.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbossts-issues mailing list