Re: deadlock in CayenneContext.commitChanges

From: Aristedes Maniatis (ar..sh.com.au)
Date: Mon Nov 12 2007 - 04:40:24 EST

  • Next message: Aristedes Maniatis: "Re: svn commit: r594123 - in /cayenne/main/trunk/framework/cayenne-modeler/src/main/resources/org/apache/cayenne/modeler/images: icon-create-listener.gif icon-create-method.gif icon-remove-listener.gif icon-remove-method.gif"

    On 12/11/2007, at 1:33 AM, Andrus Adamchik wrote:

    > Actually in 3.0 DataContext IS thread-safe (DataObjects are not).
    > CayenneContext probably not. At least no effort has been made to
    > make it thread-safe.

    OK. I reverted my change to the docs about this. I'm thinking the
    stack trace below shows that CayenneContext is not thread safe.

    > Now regarding the stack below... Is it possible to take a thread
    > dump to see what locks are involved? I.e. "kill -QUIT pid"

      [java] Found one Java-level deadlock:
          [java] =============================
          [java] "Foxtrot Single Worker Thread #4":
          [java] waiting to lock monitor 0x0080e700 (object 0x1b5518d8,
    a org.apache.cayenne.CayenneContextGraphManager),
          [java] which is held by "AWT-EventQueue-0"
          [java] "AWT-EventQueue-0":
          [java] waiting to lock monitor 0x0080e7b4 (object 0x1b3cef98,
    a org.apache.cayenne.event.DispatchQueue),
          [java] which is held by "Foxtrot Single Worker Thread #4"
          [java]
          [java] Java stack information for the threads listed above:
          [java] ===================================================
          [java] "Foxtrot Single Worker Thread #4":
          [java] at
    org
    .apache
    .cayenne
    .CayenneContextMergeHandler
    .runWithEventsDisabled(CayenneContextMergeHandler.java:266)
          [java] - waiting to lock <0x1b5518d8> (a
    org.apache.cayenne.CayenneContextGraphManager)
          [java] at
    org
    .apache
    .cayenne
    .CayenneContextMergeHandler
    .graphFlushed(CayenneContextMergeHandler.java:81)
          [java] at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown
    Source)
          [java] at
    sun
    .reflect
    .DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    25)
          [java] at java.lang.reflect.Method.invoke(Method.java:585)
          [java] at
    org.apache.cayenne.util.Invocation.fire(Invocation.java:204)
          [java] at org.apache.cayenne.event.EventManager
    $Dispatch.fire(EventManager.java:409)
          [java] at
    org
    .apache.cayenne.event.DispatchQueue.dispatchEvent(DispatchQueue.java:
    162)
          [java] at
    org
    .apache.cayenne.event.DispatchQueue.dispatchEvent(DispatchQueue.java:58)
          [java] - locked <0x1b3cef98> (a
    org.apache.cayenne.event.DispatchQueue)
          [java] at
    org.apache.cayenne.event.EventManager.dispatchEvent(EventManager.java:
    348)
          [java] at
    org.apache.cayenne.event.EventManager.postEvent(EventManager.java:319)
          [java] at
    org.apache.cayenne.remote.ClientChannel.onSync(ClientChannel.java:215)
          [java] at
    org.apache.cayenne.CayenneContext.doCommitChanges(CayenneContext.java:
    249)
          [java] - locked <0x1bcbcfe0> (a
    org.apache.cayenne.CayenneContextGraphManager)
          [java] at
    org.apache.cayenne.CayenneContext.commitChanges(CayenneContext.java:208)
          [java] at
    ish.oncourse.cayenne.CayenneContext.commitChanges(CayenneContext.java:
    80)
          [java] at
    ish
    .oncourse
    .util
    .xmlimport
    .ImportXMLHandler
    .commitAndCreateNewContextWhenObjectsInContextExceed
    (ImportXMLHandler.java:793)
          [java] at
    ish
    .oncourse
    .util.xmlimport.ImportXMLHandler.endElement(ImportXMLHandler.java:354)
          [java] at
    com
    .sun
    .org
    .apache
    .xerces
    .internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:
    633)
          [java] at
    com
    .sun
    .org
    .apache
    .xerces
    .internal
    .impl
    .XMLDocumentFragmentScannerImpl
    .scanEndElement(XMLDocumentFragmentScannerImpl.java:1241)
          [java] at
    com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl
    $
    FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:
    1685)
          [java] at
    com
    .sun
    .org
    .apache
    .xerces
    .internal
    .impl
    .XMLDocumentFragmentScannerImpl
    .scanDocument(XMLDocumentFragmentScannerImpl.java:368)
          [java] at
    com
    .sun
    .org
    .apache
    .xerces
    .internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
          [java] at
    com
    .sun
    .org
    .apache
    .xerces
    .internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
          [java] at
    com
    .sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:
    148)
          [java] at
    com
    .sun
    .org
    .apache
    .xerces
    .internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
          [java] at ish.oncourse.util.xmlimport.ImportManager
    $1.run(ImportManager.java:124)
          [java] at foxtrot.AbstractWorkerThread
    $1.run(AbstractWorkerThread.java:39)
          [java] at java.security.AccessController.doPrivileged(Native
    Method)
          [java] at
    foxtrot.AbstractWorkerThread.runTask(AbstractWorkerThread.java:35)
          [java] at
    foxtrot.workers.SingleWorkerThread.run(SingleWorkerThread.java:196)
          [java] at
    foxtrot.workers.SingleWorkerThread.run(SingleWorkerThread.java:179)
          [java] at java.lang.Thread.run(Thread.java:613)
          [java] "AWT-EventQueue-0":
          [java] at
    org
    .apache.cayenne.event.DispatchQueue.dispatchEvent(DispatchQueue.java:54)
          [java] - waiting to lock <0x1b3cef98> (a
    org.apache.cayenne.event.DispatchQueue)
          [java] at
    org.apache.cayenne.event.EventManager.dispatchEvent(EventManager.java:
    348)
          [java] at
    org.apache.cayenne.event.EventManager.postEvent(EventManager.java:319)
          [java] at
    org
    .apache
    .cayenne
    .CayenneContextGraphManager.send(CayenneContextGraphManager.java:309)
          [java] at
    org
    .apache
    .cayenne
    .CayenneContextGraphManager
    .graphCommitted(CayenneContextGraphManager.java:146)
          [java] at
    org.apache.cayenne.CayenneContext.doCommitChanges(CayenneContext.java:
    263)
          [java] - locked <0x1b5518d8> (a
    org.apache.cayenne.CayenneContextGraphManager)
          [java] at
    org.apache.cayenne.CayenneContext.commitChanges(CayenneContext.java:208)
          [java] at
    ish.oncourse.cayenne.CayenneContext.commitChanges(CayenneContext.java:
    80)
          [java] at
    ish.oncourse.PreferenceController.commit(PreferenceController.java:151)
          [java] at
    ish.oncourse.PreferenceController.setValue(PreferenceController.java:
    128)
          [java] at
    ish
    .persistence
    .CommonPreferenceController
    .setListViewColumns(CommonPreferenceController.java:799)
          [java] at
    ish.oncourse.controller.ListController.dispose(ListController.java:657)
          [java] - locked <0x1bda6ce8> (a
    ish.oncourse.controller.entity.StudentListController)
          [java] at
    ish
    .oncourse.controller.ViewController.windowClosing(ViewController.java:
    802)
          [java] at
    java.awt.AWTEventMulticaster.windowClosing(AWTEventMulticaster.java:291)
          [java] at java.awt.Window.processWindowEvent(Window.java:1203)
          [java] at javax.swing.JFrame.processWindowEvent(JFrame.java:267)
          [java] at java.awt.Window.processEvent(Window.java:1161)
          [java] at java.awt.Component.dispatchEventImpl(Component.java:
    4068)
          [java] at java.awt.Container.dispatchEventImpl(Container.java:
    2068)
          [java] at java.awt.Window.dispatchEventImpl(Window.java:1791)
          [java] at java.awt.Component.dispatchEvent(Component.java:3903)
          [java] at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
          [java] at
    java
    .awt
    .EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:
    269)
          [java] at
    java
    .awt
    .EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:
    190)
          [java] at
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
          [java] at
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
          [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
    Method)
          [java] at
    sun
    .reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
    39)
          [java] at
    sun
    .reflect
    .DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    25)
          [java] at java.lang.reflect.Method.invoke(Method.java:585)
          [java] at
    foxtrot
    .pumps.ConditionalEventPump.pumpEvents(ConditionalEventPump.java:98)
          [java] at
    foxtrot.AbstractSyncWorker.post(AbstractSyncWorker.java:98)
          [java] at foxtrot.Worker.post(Worker.java:128)
          [java] at
    ish
    .oncourse
    .util.xmlimport.ImportManager.importDocument(ImportManager.java:120)
          [java] at
    ish.oncourse.util.xmlimport.ImportManager.run(ImportManager.java:86)
          [java] at
    ish.oncourse.ControllerManager.importXML(ControllerManager.java:176)
          [java] at
    ish
    .oncourse
    .view.frame.CommonFrame.importXMLActionPerformed(CommonFrame.java:545)
          [java] at ish.oncourse.view.frame.CommonFrame.access
    $2(CommonFrame.java:544)
          [java] at ish.oncourse.view.frame.CommonFrame
    $6.actionPerformed(CommonFrame.java:253)
          [java] at
    javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1882)
          [java] at javax.swing.AbstractButton
    $Handler.actionPerformed(AbstractButton.java:2202)
          [java] at
    javax
    .swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:
    420)
          [java] at
    javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
          [java] at
    javax.swing.AbstractButton.doClick(AbstractButton.java:334)
          [java] at
    apple.laf.ScreenMenuItem.actionPerformed(ScreenMenuItem.java:96)
          [java] at java.awt.MenuItem.processActionEvent(MenuItem.java:597)
          [java] at java.awt.MenuItem.processEvent(MenuItem.java:556)
          [java] at
    java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:298)
          [java] at
    java.awt.MenuComponent.dispatchEvent(MenuComponent.java:286)
          [java] at java.awt.EventQueue.dispatchEvent(EventQueue.java:466)
          [java] at
    java
    .awt
    .EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:
    269)
          [java] at
    java
    .awt
    .EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:
    190)
          [java] at
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
          [java] at
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
          [java] at
    java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
          [java]
          [java] Found 1 deadlock.
          [java]

    -------------------------->
    ish
    http://www.ish.com.au
    Level 1, 30 Wilson Street Newtown 2042 Australia
    phone +61 2 9550 5001 fax +61 2 9550 4001
    GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A



    This archive was generated by hypermail 2.0.0 : Mon Nov 12 2007 - 04:41:05 EST