Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-957

Deadlock in nested contexts

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2 branch, 2.0 branch, 3.0
    • 3.1B2, 3.2.M1
    • Core Library
    • None

    Description

      There is a deadlock condition when two peer nested contexts commit simultaneously. The test case (attached as a patch) deadlocks almost immediately with only two threads...

      The old (pre CAY-1653 stack) :

      Name: UpdateThread-9684455
      State: BLOCKED on org.apache.cayenne.event.DispatchQueue@f899e9 owned by: UpdateThread-10872036
      Total blocked: 7 Total waited: 1

      Stack trace:
      org.apache.cayenne.event.DispatchQueue.dispatchEvent(DispatchQueue.java:54)
      org.apache.cayenne.event.EventManager.dispatchEvent(EventManager.java:348)
      org.apache.cayenne.event.EventManager.postEvent(EventManager.java:319)
      org.apache.cayenne.access.DataContext.fireDataChannelChanged(DataContext.java:1457)
      org.apache.cayenne.access.DataContext.onContextFlush(DataContext.java:1121)
      org.apache.cayenne.access.DataContext.onSync(DataContext.java:1102)
      org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1160)
      org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1073)
      org.test.Main$UpdateThread.run(Main.java:66)

      Name: UpdateThread-10872036
      State: BLOCKED on org.apache.cayenne.access.ObjectStore@1b9b03 owned by: UpdateThread-9684455
      Total blocked: 9 Total waited: 0

      Stack trace:
      org.apache.cayenne.access.DataContextMergeHandler.graphChanged(DataContextMergeHandler.java:104)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:585)
      org.apache.cayenne.util.Invocation.fire(Invocation.java:204)
      org.apache.cayenne.event.EventManager$Dispatch.fire(EventManager.java:409)
      org.apache.cayenne.event.DispatchQueue.dispatchEvent(DispatchQueue.java:162)
      org.apache.cayenne.event.DispatchQueue.dispatchEvent(DispatchQueue.java:58)
      org.apache.cayenne.event.EventManager.dispatchEvent(EventManager.java:348)
      org.apache.cayenne.event.EventManager.postEvent(EventManager.java:319)
      org.apache.cayenne.access.DataContext.fireDataChannelChanged(DataContext.java:1457)
      org.apache.cayenne.access.DataContext.onContextFlush(DataContext.java:1121)
      org.apache.cayenne.access.DataContext.onSync(DataContext.java:1102)
      org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1160)
      org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1073)
      org.test.Main$UpdateThread.run(Main.java:66)

      Newer stack is shown below in comments.

      Attachments

        Issue Links

          Activity

            People

              andrus Andrus Adamchik
              andrus Andrus Adamchik
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: