knowledge-database (beta)

Current group: comp.soft-sys.ptolemy

Re: [kepler-dev] Deadlock while wrapping up

Re: [kepler-dev] Deadlock while wrapping up  
Christopher Brooks
 Re: [kepler-dev] Deadlock while wrapping up  
xiaowen
From:Christopher Brooks
Subject:Re: [kepler-dev] Deadlock while wrapping up
Date:Tue, 21 Dec 2004 08:40:12 -0800
Hi Xiaowen,

Thanks for including the stack traces of the threads.

In ptolemy/actor/lib/ModelFrame.java, executionFinished is
synchronized.

/** Report that execution of the model has finished.
* @param manager The manager calling this method.
*/
public synchronized void executionFinished(Manager manager) {
report("execution finished.");
}

It is the only synchronized method in ModelFrame or RunTableau.
It has been synchronized since version 1.1 of ModelFrame in 28-Nov-99.

Xiaojun reported a similar bug on May 20, 2003:

> The deadlock may appear when:
> the run window of a model loses focus while the model is running,
> then regains focus (because of user action) at the time the
> execution finishes.
>
> The deadlock is between the following threads: the manager thread,
> in updating the status bar at the bottom of the run window, and
> the AWT thread, in repainting the run window.
>
> From the stack trace [...], the manager thread has a
> lock on the run window because the ModelFrame.executionFinished()
> method is synchronized. Other methods in ModelFrame, e.g.
> executionError(), managerStateChanged(), are not synchronized.
> Why?

I've gone ahead and made executionFinished() unsynchronized.

_Christopher

--------

Hi,


While running Ptolemy today, it hung while wrapping up after executing a
workflow. Remembering a hint from Christopher a few months ago on this
mailing list, I used kill -3 to obtain a stack trace, which is at the
end of this email. It looks like there was a deadlock between
"Thread-0" and "AWT-EventQueue-0". Will someone please tell me how I
can solve this or work around it so it doesn't happen again?

I'm using Ptolemy II 4.0.1.


Thanks in advance!
Xiaowen

------

[java] Full thread dump Java HotSpot(TM) Client VM (1.4.2_01-b06 mixed
mode):

[java] "Thread-0" prio=1 tid=0x089628e0 nid=0x4df9 waiting for monitor
entry [a865c000..a865c87c]
[java] at ptolemy.gui.Top.deferIfNecessary(Top.java:229)
[java] - waiting to lock <0xab4a26b0> (a java.util.LinkedList)
[java] at ptolemy.gui.Top.report(Top.java:296)
[java] at ptolemy.actor.gui.ModelFrame.executionFinished(ModelFram
e.java:139)
[java] - locked <0xabda5fb8> (a ptolemy.actor.gui.RunTableau$RunFr
ame)
[java] at ptolemy.actor.Manager._notifyListenersOfCompletion(Manag
er.java:1121)
[java] - locked <0xabda6160> (a ptolemy.actor.Manager)
[java] at ptolemy.actor.Manager.execute(Manager.java:323)
[java] - locked <0xabda6160> (a ptolemy.actor.Manager)
[java] at ptolemy.actor.Manager.run(Manager.java:852)
[java] at ptolemy.actor.Manager$2.run(Manager.java:901)

[java] "TimerQueue" daemon prio=1 tid=0x08994a58 nid=0x4df9 in Object.
wait() [a8beb000..a8beb87c]
[java] at java.lang.Object.wait(Native Method)
[java] - waiting on <0xabda6238> (a javax.swing.TimerQueue)
[java] at javax.swing.TimerQueue.run(TimerQueue.java:231)
[java] - locked <0xabda6238> (a javax.swing.TimerQueue)
[java] at java.lang.Thread.run(Thread.java:534)

[java] "Java2D Disposer" daemon prio=1 tid=0x08967a18 nid=0x4df9 in Ob
ject.wait() [a8b6a000..a8b6a87c]
[java] at java.lang.Object.wait(Native Method)
[java] at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:
111)
[java] - locked <0xabcb3110> (a java.lang.ref.ReferenceQueue$Lock)
[java] at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:
127)
[java] at sun.java2d.Disposer.run(Disposer.java:100)
[java] at java.lang.Thread.run(Thread.java:534)

[java] "DestroyJavaVM" prio=1 tid=0x080534d8 nid=0x4df9 waiting on con
dition [0..bfffc1a4]

[java] "AWT-EventQueue-0" prio=1 tid=0x083d6540 nid=0x4df9 waiting for
monitor entry [a8c6c000..a8c6c87c]
[java] at java.awt.Frame.getExtendedState(Frame.java:734)
[java] - waiting to lock <0xabda5fb8> (a ptolemy.actor.gui.RunTabl
eau$RunFrame)
[java] at javax.swing.RepaintManager.addDirtyRegion(RepaintManager
.java:265)
[java] - locked <0xabc9c1b0> (a javax.swing.RepaintManager)
[java] at javax.swing.JComponent.repaint(JComponent.java:4341)
[java] at java.awt.Component.repaint(Component.java:2451)
[java] at javax.swing.text.PlainView.damageLineRange(PlainView.jav
a:568)
[java] at javax.swing.text.PlainView.updateDamage(PlainView.java:5
29)
[java] at javax.swing.text.PlainView.removeUpdate(PlainView.java:4
34)
[java] at javax.swing.text.FieldView.removeUpdate(FieldView.java:2
88)
[java] at javax.swing.plaf.basic.BasicTextUI$RootView.removeUpdate
(BasicTextUI.java:1501)
[java] at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.removeU
pdate(BasicTextUI.java:1741)
[java] at javax.swing.text.AbstractDocument.fireRemoveUpdate(Abstr
actDocument.java:242)
[java] at javax.swing.text.AbstractDocument.handleRemove(AbstractD
ocument.java:607)
[java] at javax.swing.text.AbstractDocument.remove(AbstractDocumen
t.java:575)
[java] at javax.swing.text.AbstractDocument.replace(AbstractDocume
nt.java:665)
[java] at javax.swing.text.JTextComponent.setText(JTextComponent.j
ava:1403)
[java] at ptolemy.gui.StatusBar.setMessage(StatusBar.java:101)
[java] at ptolemy.gui.Top$5.run(Top.java:292)
[java] at ptolemy.gui.Top._executeDeferredActions(Top.java:926)
[java] - locked <0xab4a26b0> (a java.util.LinkedList)
[java] at ptolemy.gui.Top.access$000(Top.java:124)
[java] at ptolemy.gui.Top$4.run(Top.java:236)
[java] at java.awt.event.InvocationEvent.dispatch(InvocationEvent.
java:178)
[java] at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
[java] at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Ev
entDispatchThread.java:201)
[java] at java.awt.EventDispatchThread.pumpEventsForHierarchy(Even
tDispatchThread.java:151)
[java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThr
ead.java:145)
[java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThr
ead.java:137)
[java] at java.awt.EventDispatchThread.run(EventDispatchThread.jav
a:100)

[java] "AWT-Motif" daemon prio=1 tid=0x083d57a8 nid=0x4df9 runnable [a
8ced000..a8ced87c]
[java] at sun.awt.motif.MToolkit.run(Native Method)
[java] at java.lang.Thread.run(Thread.java:534)

[java] "AWT-Shutdown" prio=1 tid=0x083d52c0 nid=0x4df9 in Object.wait(
) [a8d6e000..a8d6e87c]
[java] at java.lang.Object.wait(Native Method)
[java] - waiting on <0xab3f2bd8> (a java.lang.Object)
[java] at java.lang.Object.wait(Object.java:429)
[java] at sun.awt.AWTAutoShutdown.run(AWTAutoShutdown.java:259)
[java] - locked <0xab3f2bd8> (a java.lang.Object)
[java] at java.lang.Thread.run(Thread.java:534)

[java] "Signal Dispatcher" daemon prio=1 tid=0x0809ea50 nid=0x4df9 wai
ting on condition [0..0]

[java] "Finalizer" daemon prio=1 tid=0x08089a30 nid=0x4df9 in Object.w
ait() [aad4d000..aad4d87c]
[java] at java.lang.Object.wait(Native Method)
[java] at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:
111)
[java] - locked <0xab3cc7b8> (a java.lang.ref.ReferenceQueue$Lock)
[java] at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:
127)
[java] at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.ja
va:159)

[java] "Reference Handler" daemon prio=1 tid=0x08088dc0 nid=0x4df9 in
Object.wait() [aadce000..aadce87c]
[java] at java.lang.Object.wait(Native Method)
[java] at java.lang.Object.wait(Object.java:429)
[java] at java.lang.ref.Reference$ReferenceHandler.run(Reference.j
ava:115)
[java] - locked <0xab3cc820> (a java.lang.ref.Reference$Lock)

[java] "VM Thread" prio=1 tid=0x08087990 nid=0x4df9 runnable

[java] "VM Periodic Task Thread" prio=1 tid=0x080a15f8 nid=0x4df9 wait
ing on condition
[java] "Suspend Checker Thread" prio=1 tid=0x0809e028 nid=0x4df9 runna
ble

[java] Found one Java-level deadlock:
[java] =============================
[java] "Thread-0":
[java] waiting to lock monitor 0x0843100c (object 0xab4a26b0, a java
.util.LinkedList),
[java] which is held by "AWT-EventQueue-0"
[java] "AWT-EventQueue-0":
[java] waiting to lock monitor 0x08431044 (object 0xabda5fb8, a ptol
emy.actor.gui.RunTableau$RunFrame),
[java] which is held by "Thread-0"

[java] Java stack information for the threads listed above:
[java] ===================================================
[java] "Thread-0":
[java] at ptolemy.gui.Top.deferIfNecessary(Top.java:229)
[java] - waiting to lock <0xab4a26b0> (a java.util.LinkedList)
[java] at ptolemy.gui.Top.report(Top.java:296)
[java] at ptolemy.actor.gui.ModelFrame.executionFinished(ModelFram
e.java:139)
[java] - locked <0xabda5fb8> (a ptolemy.actor.gui.RunTableau$RunFr
ame)
[java] at ptolemy.actor.Manager._notifyListenersOfCompletion(Manag
er.java:1121)
[java] - locked <0xabda6160> (a ptolemy.actor.Manager)
[java] at ptolemy.actor.Manager.execute(Manager.java:323)
[java] - locked <0xabda6160> (a ptolemy.actor.Manager)
[java] at ptolemy.actor.Manager.run(Manager.java:852)
[java] at ptolemy.actor.Manager$2.run(Manager.java:901)
[java] "AWT-EventQueue-0":
[java] at java.awt.Frame.getExtendedState(Frame.java:734)
[java] - waiting to lock <0xabda5fb8> (a ptolemy.actor.gui.RunTabl
eau$RunFrame)
[java] at javax.swing.RepaintManager.addDirtyRegion(RepaintManager
.java:265)
[java] - locked <0xabc9c1b0> (a javax.swing.RepaintManager)
[java] at javax.swing.JComponent.repaint(JComponent.java:4341)
[java] at java.awt.Component.repaint(Component.java:2451)
[java] at javax.swing.text.PlainView.damageLineRange(PlainView.jav
a:568)
[java] at javax.swing.text.PlainView.updateDamage(PlainView.java:5
29)
[java] at javax.swing.text.PlainView.removeUpdate(PlainView.java:4
34)
[java] at javax.swing.text.FieldView.removeUpdate(FieldView.java:2
88)
[java] at javax.swing.plaf.basic.BasicTextUI$RootView.removeUpdate
(BasicTextUI.java:1501)
[java] at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.removeU
pdate(BasicTextUI.java:1741)
[java] at javax.swing.text.AbstractDocument.fireRemoveUpdate(Abstr
actDocument.java:242)
[java] at javax.swing.text.AbstractDocument.handleRemove(AbstractD
ocument.java:607)
[java] at javax.swing.text.AbstractDocument.remove(AbstractDocumen
t.java:575)
[java] at javax.swing.text.AbstractDocument.replace(AbstractDocume
nt.java:665)
[java] at javax.swing.text.JTextComponent.setText(JTextComponent.j
ava:1403)
[java] at ptolemy.gui.StatusBar.setMessage(StatusBar.java:101)
[java] at ptolemy.gui.Top$5.run(Top.java:292)
[java] at ptolemy.gui.Top._executeDeferredActions(Top.java:926)
[java] - locked <0xab4a26b0> (a java.util.LinkedList)
[java] at ptolemy.gui.Top.access$000(Top.java:124)
[java] at ptolemy.gui.Top$4.run(Top.java:236)
[java] at java.awt.event.InvocationEvent.dispatch(InvocationEvent.
java:178)
[java] at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
[java] at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Ev
entDispatchThread.java:201)
[java] at java.awt.EventDispatchThread.pumpEventsForHierarchy(Even
tDispatchThread.java:151)
[java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThr
ead.java:145)
[java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThr
ead.java:137)
[java] at java.awt.EventDispatchThread.run(EventDispatchThread.jav
a:100)

[java] Found 1 deadlock.


_______________________________________________
kepler-dev mailing list
kepler-dev@ecoinformatics.org
http://www.ecoinformatics.org/mailman/listinfo/kepler-dev
--------

----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list. Please send administrative
mail for this list to: ptolemy-hackers-request@ptolemy.eecs.berkeley.edu
From:xiaowen
Subject:Re: [kepler-dev] Deadlock while wrapping up
Date:Tue, 21 Dec 2004 14:48:59 -0800
Hi Christopher,


Does Ptolemy II release patches against 4.0.1 so that users of the
latest stable release can also benefit from the bug fixes?

Most users of SPA/Kepler don't have Ptolemy CVS accounts, and many/most
of them probably prefer to stick with the latest stable release anyway.
I'm wondering what the best way is for SPA/Kepler developers to
distribute workflows. Must we also send users instructions for how to
patch Ptolemy?


Thanks!
Xiaowen


Am Dienstag, den 21.12.2004, 08:40 -0800 schrieb Christopher Brooks:
> Hi Xiaowen,
>
> Thanks for including the stack traces of the threads.
>
> In ptolemy/actor/lib/ModelFrame.java, executionFinished is
> synchronized.
>
> /** Report that execution of the model has finished.
> * @param manager The manager calling this method.
> */
> public synchronized void executionFinished(Manager manager) {
> report("execution finished.");
> }
>
> It is the only synchronized method in ModelFrame or RunTableau.
> It has been synchronized since version 1.1 of ModelFrame in 28-Nov-99.
>
> Xiaojun reported a similar bug on May 20, 2003:
>
> > The deadlock may appear when:
> > the run window of a model loses focus while the model is running,
> > then regains focus (because of user action) at the time the
> > execution finishes.
> >
> > The deadlock is between the following threads: the manager thread,
> > in updating the status bar at the bottom of the run window, and
> > the AWT thread, in repainting the run window.
> >
> > From the stack trace [...], the manager thread has a
> > lock on the run window because the ModelFrame.executionFinished()
> > method is synchronized. Other methods in ModelFrame, e.g.
> > executionError(), managerStateChanged(), are not synchronized.
> > Why?
>
> I've gone ahead and made executionFinished() unsynchronized.
>
> _Christopher


----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list. Please send administrative
mail for this list to: ptolemy-hackers-request@ptolemy.eecs.berkeley.edu
   

Copyright © 2006 knowledge-database   -   All rights reserved