[jboss-jira] [JBoss JIRA] Created: (JBTM-182) Missing synchronization?

Mark Little (JIRA) jira-events at jboss.com
Sat Dec 23 11:36:39 EST 2006


Missing synchronization?
------------------------

                 Key: JBTM-182
                 URL: http://jira.jboss.com/jira/browse/JBTM-182
             Project: JBoss Transaction Manager
          Issue Type: Task
      Security Level: Public (Everyone can see)
          Components: JTA Implementation
    Affects Versions: 4.2.3
            Reporter: Mark Little
         Assigned To: Jonathan Halliday
             Fix For: 4.2.3


In addSynchronization for TwoPhaseCoordinator, the synchronization object is created if it isn't already set:

if (_synchs == null)
{
	// Synchronizations should be stored (or at least iterated) in their natural order
	_synchs = new TreeSet();
}

if (_synchs.add(sr))
{
	result = AddOutcome.AR_ADDED;
}

However, because multiple threads could be calling the same transaction instance concurrently, shouldn't there be a synchronization around this block? It's possible that two threads could test and try to set the _synchs and because of interleaving one thread creates _synchs after the other thread already has and added it's resource (which would then become garbage).

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

        



More information about the jboss-jira mailing list