History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: CDV-771
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: 2 Major 2 Major
Assignee: Hung Huynh
Reporter: Scott Bale
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Community Development

synchronization in StandardDSOClientConfigHelperImpl causing deadlock

Created: 30/May/08 03:07 PM   Updated: 01/Jul/08 05:02 PM  Due: 13/Jun/08
Component/s: DSO:L1
Affects Version/s: 2.6.0
Fix Version/s: 2.6.2

Severity: 2 Feature failure (but system usable), no workaround available
Fix In Branch: trunk, 2.6
Target: 2.6.2
Fixed In Revision: 8706, 8713 (trunk) and 8726 (2.6 branch)
Bug Type: Race Condition
Bug Found In Detail: 2.6.0
Date of First Response: 02/Jun/08 07:38 AM


 Description  « Hide
From forum thread http://forums.terracotta.org/forums/posts/list/1107.page

synchronization in StandardDSOClientConfigHelperImpl.getInstrumentationDescriptorFor() method can lead to deadlocks, because the call to InstrumentationDescriptor.matches(..) within the synchronized block triggers many more method calls which can contend for locks. In the case of this forum post, the other lock belonged to a ClassLoader instance that was already held by another thread, which was trying to acquire the lock for the LinkedList of InstrumentationDescriptors.

It would be nice to go to a copy-on-write data structure to hold those InstrumentationDescriptors, so synchronization wasn't necessary on the read operations. If nothing else, you could always copy-on-read within the synchronized block, then iterate and check after relinquishing the lock. Tim points out that there may be additional more complicated synchronization and atomicity requirements around the addIncludeAndLockIfRequired() method (but we could use a different lock there).

 All   Comments   Change History      Sort Order:
Alex Miller - 02/Jun/08 07:38 AM
Assigning to Scott as he has been hashing through some options with Tim.

Scott Bale - 02/Jun/08 09:54 AM
Switched to using a CopyOnWriteArrayList for "instrumentationDescriptors". This should prevent the deadlock which the forum user experienced, which happened when trying to read (iterate) this List.

Fiona O'Shea - 02/Jun/08 11:56 AM - edited
This fix will be available in trunk-nightly builds after revision 8706

Scott Bale - 03/Jun/08 12:13 PM
Added revision 8713 to this JIRA, which was additional correction to synchronization within the same class as was modified in 8706. Merged to 2.6 branch (revision 8726).