Benoker / DockingFrames

http://www.docking-frames.org
96 stars 46 forks source link

java.lang.IllegalStateException: During an operation the framework attempted to acquire the same lock twice. #50

Open krichter722 opened 8 years ago

krichter722 commented 8 years ago

I'm experiencing java.lang.IllegalStateException: During an operation the framework attempted to acquire the same lock twice. and made sure that every time CControl is accessed SwingUtilities.isEventHandlingThread() returns true in a debugger.

The stack is:

java.lang.IllegalStateException: During an operation the framework attempted to acquire the same lock twice. There are two possible explanations:
1. In a multi-threaded application one or both operations are not executed in the EventDispatchThread, or
2. The operations are calling each other, which should not happen.
Please verify that this application is not accessing the framework from different threads, and fill a bugreport if you feel that this exception is not caused by your application.
    at bibliothek.gui.dock.DockHierarchyLock.acquireUnlink(DockHierarchyLock.java:314)
    at bibliothek.gui.dock.DockHierarchyLock.acquireUnlinking(DockHierarchyLock.java:226)
    at bibliothek.gui.dock.SplitDockStation.removeDisplayer(SplitDockStation.java:3104)
    at bibliothek.gui.dock.SplitDockStation.removeHandle(SplitDockStation.java:3080)
    at bibliothek.gui.dock.SplitDockStation.access$1700(SplitDockStation.java:189)
    at bibliothek.gui.dock.SplitDockStation$Access.removeHandle(SplitDockStation.java:3390)
    at bibliothek.gui.dock.station.split.Leaf.setDockable(Leaf.java:181)
    at bibliothek.gui.dock.SplitDockStation.removeDockable(SplitDockStation.java:3009)
    at bibliothek.gui.dock.SplitDockStation.drag(SplitDockStation.java:2644)
    at bibliothek.gui.DockFrontend.hide(DockFrontend.java:1485)
    at bibliothek.gui.DockFrontend.hide(DockFrontend.java:1463)
    at bibliothek.gui.dock.common.CControl$Access.hide(CControl.java:2817)
    at bibliothek.gui.dock.common.intern.AbstractCDockable.setVisible(AbstractCDockable.java:323)
    at bibliothek.gui.dock.common.CControl.removeDockable(CControl.java:2157)
    at bibliothek.gui.dock.common.CControl.replace(CControl.java:2051)
    at richtercloud.document.scanner.gui.MainPanel.switchDocument(MainPanel.java:784)
    at richtercloud.document.scanner.gui.MainPanel.access$200(MainPanel.java:132)
    at richtercloud.document.scanner.gui.MainPanel$1.willGainFocus(MainPanel.java:281)
    at bibliothek.gui.dock.common.intern.CListenerCollection$4.willGainFocus(CListenerCollection.java:158)
    at bibliothek.gui.dock.common.intern.ControlVetoFocusListener.veto(ControlVetoFocusListener.java:42)
    at bibliothek.gui.dock.common.intern.ControlVetoFocusListener.vetoFocus(ControlVetoFocusListener.java:54)
    at bibliothek.gui.dock.control.focus.AbstractFocusController.fireVetoDockable(AbstractFocusController.java:147)
    at bibliothek.gui.dock.control.DefaultFocusController.checkFocusedDockable(DefaultFocusController.java:102)
    at bibliothek.gui.dock.control.DefaultFocusController.accept(DefaultFocusController.java:194)
    at bibliothek.gui.dock.control.DefaultFocusController$Request.accept(DefaultFocusController.java:362)
    at bibliothek.gui.dock.control.DefaultFocusController$Request.run(DefaultFocusController.java:372)
    at bibliothek.gui.dock.control.DefaultFocusController$Request.enqueue(DefaultFocusController.java:327)
    at bibliothek.gui.dock.control.DefaultFocusController.focus(DefaultFocusController.java:132)
    at bibliothek.gui.DockController.setFocusedDockable(DockController.java:1051)
    at bibliothek.gui.dock.common.intern.CDockController.setFocusedDockable(CDockController.java:70)
    at bibliothek.gui.dock.StackDockStation$VisibleListener.selectionChanged(StackDockStation.java:1681)
    at bibliothek.gui.dock.station.stack.DefaultStackDockComponent$Listener.stateChanged(DefaultStackDockComponent.java:368)
    at javax.swing.JTabbedPane.fireStateChanged(JTabbedPane.java:416)
    at javax.swing.JTabbedPane$ModelListener.stateChanged(JTabbedPane.java:270)
    at javax.swing.DefaultSingleSelectionModel.fireStateChanged(DefaultSingleSelectionModel.java:132)
    at javax.swing.DefaultSingleSelectionModel.setSelectedIndex(DefaultSingleSelectionModel.java:67)
    at javax.swing.JTabbedPane.setSelectedIndexImpl(JTabbedPane.java:616)
    at javax.swing.JTabbedPane.setSelectedIndex(JTabbedPane.java:591)
    at javax.swing.JTabbedPane.insertTab(JTabbedPane.java:731)
    at bibliothek.gui.dock.station.stack.DefaultStackDockComponent.insertTab(DefaultStackDockComponent.java:145)
    at bibliothek.gui.dock.StackDockStation.insertTab(StackDockStation.java:1483)
    at bibliothek.gui.dock.StackDockStation.addToPanel(StackDockStation.java:1429)
    at bibliothek.gui.dock.StackDockStation.add(StackDockStation.java:1384)
    at bibliothek.gui.dock.StackDockStation.drop(StackDockStation.java:1163)
    at bibliothek.gui.dock.StackDockStation.drop(StackDockStation.java:1116)
    at bibliothek.gui.dock.StackDockStation.drop(StackDockStation.java:1099)
    at bibliothek.gui.dock.themes.basic.BasicCombiner.combine(BasicCombiner.java:97)
    at bibliothek.gui.dock.themes.ThemeCombiner.combine(ThemeCombiner.java:81)
    at bibliothek.gui.dock.themes.StationCombinerValue.combine(StationCombinerValue.java:82)
    at bibliothek.gui.dock.SplitDockStation.dropOver(SplitDockStation.java:2392)
    at bibliothek.gui.dock.SplitDockStation.drop(SplitDockStation.java:1992)
    at bibliothek.gui.dock.SplitDockStation.access$1800(SplitDockStation.java:189)
    at bibliothek.gui.dock.SplitDockStation$Access.drop(SplitDockStation.java:3394)
    at bibliothek.gui.dock.station.split.Leaf.insert(Leaf.java:526)
    at bibliothek.gui.dock.station.split.Node.insert(Node.java:613)
    at bibliothek.gui.dock.station.split.Node.insert(Node.java:613)
    at bibliothek.gui.dock.station.split.Root.insert(Root.java:306)
    at bibliothek.gui.dock.SplitDockStation.drop(SplitDockStation.java:2269)
    at bibliothek.gui.dock.SplitDockStation.drop(SplitDockStation.java:1799)
    at bibliothek.gui.dock.common.mode.station.CSplitDockStationHandle$Normal.setLocation(CSplitDockStationHandle.java:377)
    at bibliothek.gui.dock.facile.mode.DefaultLocationMode.runApply(DefaultLocationMode.java:77)
    at bibliothek.gui.dock.facile.mode.AbstractLocationMode.apply(AbstractLocationMode.java:404)
    at bibliothek.gui.dock.facile.mode.AbstractLocationMode.apply(AbstractLocationMode.java:55)
    at bibliothek.gui.dock.support.mode.ModeManager$4.run(ModeManager.java:700)
    at bibliothek.gui.dock.support.mode.ModeManager.runTransaction(ModeManager.java:514)
    at bibliothek.gui.dock.support.mode.ModeManager.runTransaction(ModeManager.java:493)
    at bibliothek.gui.dock.support.mode.ModeManager.apply(ModeManager.java:694)
    at bibliothek.gui.dock.facile.mode.LocationModeManager.apply(LocationModeManager.java:376)
    at bibliothek.gui.dock.facile.mode.LocationModeManager.apply(LocationModeManager.java:82)
    at bibliothek.gui.dock.support.mode.ModeManager.apply(ModeManager.java:625)
    at bibliothek.gui.dock.support.mode.ModeManager.apply(ModeManager.java:561)
    at bibliothek.gui.dock.common.mode.CLocationModeManager.setLocation(CLocationModeManager.java:261)
    at bibliothek.gui.dock.common.CControl$Access.show(CControl.java:2860)
    at bibliothek.gui.dock.common.intern.AbstractCDockable.setVisible(AbstractCDockable.java:320)
    at richtercloud.document.scanner.gui.MainPanel.addDocumentDockable(MainPanel.java:734)
    at richtercloud.document.scanner.gui.MainPanel.addDocumentDone(MainPanel.java:499)
    at richtercloud.document.scanner.gui.MainPanel.access$600(MainPanel.java:132)
    at richtercloud.document.scanner.gui.MainPanel$3.done(MainPanel.java:469)
    at javax.swing.SwingWorker$5.run(SwingWorker.java:737)
    at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:832)
    at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
    at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:842)
    at javax.swing.Timer.fireActionPerformed(Timer.java:313)
    at javax.swing.Timer$DoPostEvent.run(Timer.java:245)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Could you tell from the stack whether this is an obvious user error - which contradicts the message 1. and the debugger tests I conducted. If not, I'll produce a minimal test case. I'm aware that this is not the best bug reporting etiquette, but it's necessary to spare a lot of unnecessary work and the message printed by the framework is quite clear.

experienced with 1.1.2p16a-26-g82473c3 (which is 1.1.2-P17b in maven - maybe a missing tag?)

Benoker commented 8 years ago

It is the second explanation:

You are just adding something to your UI in "|||at richtercloud.document.scanner.gui.MainPanel.addDocumentDockable(MainPanel.java:734)|" and when your application is receiving the event that something just happened it tries to modify UI again in "|||at richtercloud.document.scanner.gui.MainPanel.switchDocument(MainPanel.java:784)|". This is attempting to run an operation "within" another operation, because you receive the event before the first operation completed. The lock exists to detect and prevent exactly this kind of nested operations ;-)

A solution could be to invoke "SwingUtilities.invokeLater" in "|switchDocument|" in order to execute the "switch" after the first operation (adding a new Dockable) is completed.

Regards Beni |

I'm experiencing |java.lang.IllegalStateException: During an operation the framework attempted to acquire the same lock twice.| and made sure that every time |CControl| is accessed |SwingUtilities.isEventHandlingThread()| returns |true| in a debugger.

The stack is:

|java.lang.IllegalStateException: During an operation the framework attempted to acquire the same lock twice. There are two possible explanations: 1. In a multi-threaded application one or both operations are not executed in the EventDispatchThread, or 2. The operations are calling each other, which should not happen. Please verify that this application is not accessing the framework from different threads, and fill a bugreport if you feel that this exception is not caused by your application. at bibliothek.gui.dock.DockHierarchyLock.acquireUnlink(DockHierarchyLock.java:314) at bibliothek.gui.dock.DockHierarchyLock.acquireUnlinking(DockHierarchyLock.java:226) at bibliothek.gui.dock.SplitDockStation.removeDisplayer(SplitDockStation.java:3104) at bibliothek.gui.dock.SplitDockStation.removeHandle(SplitDockStation.java:3080) at bibliothek.gui.dock.SplitDockStation.access$1700(SplitDockStation.java:189) at bibliothek.gui.dock.SplitDockStation$Access.removeHandle(SplitDockStation.java:3390) at bibliothek.gui.dock.station.split.Leaf.setDockable(Leaf.java:181) at bibliothek.gui.dock.SplitDockStation.removeDockable(SplitDockStation.java:3009) at bibliothek.gui.dock.SplitDockStation.drag(SplitDockStation.java:2644) at bibliothek.gui.DockFrontend.hide(DockFrontend.java:1485) at bibliothek.gui.DockFrontend.hide(DockFrontend.java:1463) at bibliothek.gui.dock.common.CControl$Access.hide(CControl.java:2817) at bibliothek.gui.dock.common.intern.AbstractCDockable.setVisible(AbstractCDockable.java:323) at bibliothek.gui.dock.common.CControl.removeDockable(CControl.java:2157) at bibliothek.gui.dock.common.CControl.replace(CControl.java:2051) at richtercloud.document.scanner.gui.MainPanel.switchDocument(MainPanel.java:784) at richtercloud.document.scanner.gui.MainPanel.access$200(MainPanel.java:132) at richtercloud.document.scanner.gui.MainPanel$1.willGainFocus(MainPanel.java:281) at bibliothek.gui.dock.common.intern.CListenerCollection$4.willGainFocus(CListenerCollection.java:158) at bibliothek.gui.dock.common.intern.ControlVetoFocusListener.veto(ControlVetoFocusListener.java:42) at bibliothek.gui.dock.common.intern.ControlVetoFocusListener.vetoFocus(ControlVetoFocusListener.java:54) at bibliothek.gui.dock.control.focus.AbstractFocusController.fireVetoDockable(AbstractFocusController.java:147) at bibliothek.gui.dock.control.DefaultFocusController.checkFocusedDockable(DefaultFocusController.java:102) at bibliothek.gui.dock.control.DefaultFocusController.accept(DefaultFocusController.java:194) at bibliothek.gui.dock.control.DefaultFocusController$Request.accept(DefaultFocusController.java:362) at bibliothek.gui.dock.control.DefaultFocusController$Request.run(DefaultFocusController.java:372) at bibliothek.gui.dock.control.DefaultFocusController$Request.enqueue(DefaultFocusController.java:327) at bibliothek.gui.dock.control.DefaultFocusController.focus(DefaultFocusController.java:132) at bibliothek.gui.DockController.setFocusedDockable(DockController.java:1051) at bibliothek.gui.dock.common.intern.CDockController.setFocusedDockable(CDockController.java:70) at bibliothek.gui.dock.StackDockStation$VisibleListener.selectionChanged(StackDockStation.java:1681) at bibliothek.gui.dock.station.stack.DefaultStackDockComponent$Listener.stateChanged(DefaultStackDockComponent.java:368) at javax.swing.JTabbedPane.fireStateChanged(JTabbedPane.java:416) at javax.swing.JTabbedPane$ModelListener.stateChanged(JTabbedPane.java:270) at javax.swing.DefaultSingleSelectionModel.fireStateChanged(DefaultSingleSelectionModel.java:132) at javax.swing.DefaultSingleSelectionModel.setSelectedIndex(DefaultSingleSelectionModel.java:67) at javax.swing.JTabbedPane.setSelectedIndexImpl(JTabbedPane.java:616) at javax.swing.JTabbedPane.setSelectedIndex(JTabbedPane.java:591) at javax.swing.JTabbedPane.insertTab(JTabbedPane.java:731) at bibliothek.gui.dock.station.stack.DefaultStackDockComponent.insertTab(DefaultStackDockComponent.java:145) at bibliothek.gui.dock.StackDockStation.insertTab(StackDockStation.java:1483) at bibliothek.gui.dock.StackDockStation.addToPanel(StackDockStation.java:1429) at bibliothek.gui.dock.StackDockStation.add(StackDockStation.java:1384) at bibliothek.gui.dock.StackDockStation.drop(StackDockStation.java:1163) at bibliothek.gui.dock.StackDockStation.drop(StackDockStation.java:1116) at bibliothek.gui.dock.StackDockStation.drop(StackDockStation.java:1099) at bibliothek.gui.dock.themes.basic.BasicCombiner.combine(BasicCombiner.java:97) at bibliothek.gui.dock.themes.ThemeCombiner.combine(ThemeCombiner.java:81) at bibliothek.gui.dock.themes.StationCombinerValue.combine(StationCombinerValue.java:82) at bibliothek.gui.dock.SplitDockStation.dropOver(SplitDockStation.java:2392) at bibliothek.gui.dock.SplitDockStation.drop(SplitDockStation.java:1992) at bibliothek.gui.dock.SplitDockStation.access$1800(SplitDockStation.java:189) at bibliothek.gui.dock.SplitDockStation$Access.drop(SplitDockStation.java:3394) at bibliothek.gui.dock.station.split.Leaf.insert(Leaf.java:526) at bibliothek.gui.dock.station.split.Node.insert(Node.java:613) at bibliothek.gui.dock.station.split.Node.insert(Node.java:613) at bibliothek.gui.dock.station.split.Root.insert(Root.java:306) at bibliothek.gui.dock.SplitDockStation.drop(SplitDockStation.java:2269) at bibliothek.gui.dock.SplitDockStation.drop(SplitDockStation.java:1799) at bibliothek.gui.dock.common.mode.station.CSplitDockStationHandle$Normal.setLocation(CSplitDockStationHandle.java:377) at bibliothek.gui.dock.facile.mode.DefaultLocationMode.runApply(DefaultLocationMode.java:77) at bibliothek.gui.dock.facile.mode.AbstractLocationMode.apply(AbstractLocationMode.java:404) at bibliothek.gui.dock.facile.mode.AbstractLocationMode.apply(AbstractLocationMode.java:55) at bibliothek.gui.dock.support.mode.ModeManager$4.run(ModeManager.java:700) at bibliothek.gui.dock.support.mode.ModeManager.runTransaction(ModeManager.java:514) at bibliothek.gui.dock.support.mode.ModeManager.runTransaction(ModeManager.java:493) at bibliothek.gui.dock.support.mode.ModeManager.apply(ModeManager.java:694) at bibliothek.gui.dock.facile.mode.LocationModeManager.apply(LocationModeManager.java:376) at bibliothek.gui.dock.facile.mode.LocationModeManager.apply(LocationModeManager.java:82) at bibliothek.gui.dock.support.mode.ModeManager.apply(ModeManager.java:625) at bibliothek.gui.dock.support.mode.ModeManager.apply(ModeManager.java:561) at bibliothek.gui.dock.common.mode.CLocationModeManager.setLocation(CLocationModeManager.java:261) at bibliothek.gui.dock.common.CControl$Access.show(CControl.java:2860) at bibliothek.gui.dock.common.intern.AbstractCDockable.setVisible(AbstractCDockable.java:320) at richtercloud.document.scanner.gui.MainPanel.addDocumentDockable(MainPanel.java:734) at richtercloud.document.scanner.gui.MainPanel.addDocumentDone(MainPanel.java:499) at richtercloud.document.scanner.gui.MainPanel.access$600(MainPanel.java:132) at richtercloud.document.scanner.gui.MainPanel$3.done(MainPanel.java:469) at javax.swing.SwingWorker$5.run(SwingWorker.java:737) at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:832) at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112) at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:842) at javax.swing.Timer.fireActionPerformed(Timer.java:313) at javax.swing.Timer$DoPostEvent.run(Timer.java:245) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:726) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) |

Could you tell from the stack whether this is an obvious user error - which contradicts the message |1.| and the debugger tests I conducted. If not, I'll produce a minimal test case. I'm aware that this is not the best bug reporting etiquette, but it's necessary to spare a lot of unnecessary work and the message printed by the framework is quite clear.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Benoker/DockingFrames/issues/50, or mute the thread https://github.com/notifications/unsubscribe-auth/AAxqEKwPJuc91B0Otgy-E9r-au2dGNekks5qroSygaJpZM4KAcoi.