Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: 2 Major 2 Major
  • Resolution: Fixed
  • Affects Version/s: 2.6.0
  • Fix Version/s: 2.6.2
  • Component/s: DSO:L1
  • Labels:
    None
  • Severity:
    2 Feature failure (but system usable), no workaround available
  • Fix In Branch:
    trunk, 2.6
  • Fixed In Revision:
    8706, 8713 (trunk) and 8726 (2.6 branch)
  • Bug Type:
    Race Condition
  • Bug Found In Detail:
    2.6.0

Description

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).

Activity

Hide
Alex Miller added a comment -

Assigning to Scott as he has been hashing through some options with Tim.

Show
Alex Miller added a comment - Assigning to Scott as he has been hashing through some options with Tim.
Hide
Scott Bale added a comment -

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.

Show
Scott Bale added a comment - 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.
Hide
Fiona O'Shea added a comment - - edited

This fix will be available in trunk-nightly builds after revision 8706

Show
Fiona O'Shea added a comment - - edited This fix will be available in trunk-nightly builds after revision 8706
Hide
Scott Bale added a comment -

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).

Show
Scott Bale added a comment - 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).

People

Vote (0)
Watch (1)

Dates

  • Due:
    Created:
    Updated:
    Resolved: