468,133 Members | 1,351 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,133 developers. It's quick & easy.

Invisible Deadlock


Hi all,

I have a strange behaviour where the AppContext.get() is waiting for
lock of a HashMap that is not locked by any other task. This freezes my
GUI because the AWT-EventQueue wants to stop a javax.swing.Timer that is
locked by the TimerQueue Thread that is waiting for the HashMap.

I have no idea how to catch problem. Am I am doing something wrong with
the timer? Any hint how I can get more information about the reason? Any
workaround?

Our application uses many trees and tables in some Frames that are
updated via javax.swing.Timer because the burst load is to heave for an
event driven update. The App must run all the time because it monitors
network devices. A frozen GUI is the worst thing that could hapen to our
App because normally there are no user actions and the user will not be
aware of this. The App is running on serveral linux machines (debian,
redhead, suse with different versions) with serveral JDK 1.4.xxx. Every
where the same.

Can someone help me with this matter?
Thanks.
Peter

Full thread dump Java HotSpot(TM) Client VM (1.4.2_04-b05 mixed mode):

"JDWP Command Reader" daemon prio=1 tid=0x0838c3d8 nid=0x4e33 runnable
[0..0]

"Thread-2" prio=1 tid=0x08277ce0 nid=0x4e33 runnable [5a148000..5a1488bc]
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream. java:129)
at java.net.SocketInputStream.read(SocketInputStream. java:182)
at
java.io.ObjectInputStream$PeekInputStream.peek(Obj ectInputStream.java:2133)
at
java.io.ObjectInputStream$BlockDataInputStream.pee k(ObjectInputStream.java:2423)
at
java.io.ObjectInputStream$BlockDataInputStream.pee kByte(ObjectInputStream.java:2433)
at
java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1245)
at java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:324)
at
com.atecom.lib.network.impl.BlockingSocketThread.r un(BlockingSocketThread.java:51)

"MemoryLabel" prio=1 tid=0x0828b8f0 nid=0x4e33 waiting on condition
[599de000..599de8bc]
at java.lang.Thread.sleep(Native Method)
at com.atecom.lib.util.Misc.sleep(Misc.java:773)
at
com.atecom.maya.client.gui.common.JButtonMemory$1. run(JButtonMemory.java:69)

"TimerQueue" daemon prio=1 tid=0x0835a228 nid=0x4e33 waiting for monitor
entry [5a037000..5a0378bc]
at sun.awt.AppContext.get(AppContext.java:542)
- waiting to lock <0x45b687b0> (a java.util.HashMap)
at
sun.awt.SunToolkit.getSystemEventQueueImplPP(SunTo olkit.java:543)
at sun.awt.SunToolkit.getSystemEventQueueImpl(SunTool kit.java:537)
at java.awt.Toolkit.getEventQueue(Toolkit.java:1519)
at java.awt.EventQueue.invokeLater(EventQueue.java:79 2)
at javax.swing.SwingUtilities.invokeLater(SwingUtilit ies.java:1170)
at javax.swing.Timer.post(Timer.java:538)
- locked <0x45eaade0> (a javax.swing.Timer)
at javax.swing.TimerQueue.postExpiredTimers(TimerQueu e.java:193)
- locked <0x45be7528> (a javax.swing.TimerQueue)
at javax.swing.TimerQueue.run(TimerQueue.java:229)
- locked <0x45be7528> (a javax.swing.TimerQueue)
at java.lang.Thread.run(Thread.java:534)

"Java2D Disposer" daemon prio=1 tid=0x08285b58 nid=0x4e33 in
Object.wait() [59eff000..59eff8bc]
at java.lang.Object.wait(Native Method)
- waiting on <0x45ba3b58> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue .java:111)
- locked <0x45ba3b58> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue .java:127)
at sun.java2d.Disposer.run(Disposer.java:100)
at java.lang.Thread.run(Thread.java:534)

"AWT-EventQueue-0" prio=1 tid=0x0819d2d8 nid=0x4e33 waiting for monitor
entry [59e7f000..59e7f8bc]
at javax.swing.TimerQueue.removeTimer(TimerQueue.java :135)
- waiting to lock <0x45be7528> (a javax.swing.TimerQueue)
at javax.swing.Timer.stop(Timer.java:509)
at
javax.swing.ToolTipManager.initiateToolTip(ToolTip Manager.java:468)
at javax.swing.ToolTipManager.mouseEntered(ToolTipMan ager.java:458)
at java.awt.Component.processMouseEvent(Component.jav a:5109)
at java.awt.Component.processEvent(Component.java:489 7)
at java.awt.Container.processEvent(Container.java:156 9)
at java.awt.Component.dispatchEventImpl(Component.jav a:3615)
at java.awt.Container.dispatchEventImpl(Container.jav a:1627)
at java.awt.Component.dispatchEvent(Component.java:34 77)
at
java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:3483)
at
java.awt.LightweightDispatcher.trackMouseEnterExit (Container.java:3323)
at
java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:3180)
at
java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:3128)
at java.awt.Container.dispatchEventImpl(Container.jav a:1613)
at java.awt.Window.dispatchEventImpl(Window.java:1606 )
at java.awt.Component.dispatchEvent(Component.java:34 77)
at java.awt.EventQueue.dispatchEvent(EventQueue.java: 456)
at
java.awt.EventDispatchThread.pumpOneEventForHierar chy(EventDispatchThread.java:201)
at
java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:151)
at
java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:145)
at
java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:100)

"Maya Memory Watchdog" prio=1 tid=0x0818d250 nid=0x4e33 waiting on
condition [59dff000..59dff8bc]
at java.lang.Thread.sleep(Native Method)
at com.atecom.lib.util.Misc.sleep(Misc.java:773)
at
com.atecom.maya.client.ClientApplication$3.run(Cli entApplication.java:338)

"MayaWorkerThread" prio=1 tid=0x0818cf48 nid=0x4e33 in Object.wait()
[59d7f000..59d7f8bc]
at java.lang.Object.wait(Native Method)
at com.atecom.lib.util.WorkerThread.run(WorkerThread. java:72)
- locked <0x45b70928> (a com.atecom.maya.client.MayaWorkerThread)

"Thread-1" prio=1 tid=0x0816afa0 nid=0x4e33 runnable [59cff000..59cff8bc]
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream. java:129)
at java.net.SocketInputStream.read(SocketInputStream. java:182)
at java.io.DataInputStream.readInt(DataInputStream.ja va:443)
at
com.atecom.maya.protocol.AlarmConverter.readAlarm( AlarmConverter.java:98)
at
com.atecom.maya.client.alarmserver.ConnectionAlarm Server.run(ConnectionAlarmServer.java:193)
at java.lang.Thread.run(Thread.java:534)

"AWT-Motif" daemon prio=1 tid=0x081892d0 nid=0x4e33 runnable
[59c7f000..59c7f8bc]
at sun.awt.motif.MToolkit.run(Native Method)
at java.lang.Thread.run(Thread.java:534)

"AWT-Shutdown" prio=1 tid=0x08188f30 nid=0x4e33 in Object.wait()
[59aff000..59aff8bc]
at java.lang.Object.wait(Native Method)
- waiting on <0x45b3ee78> (a java.lang.Object)
at java.lang.Object.wait(Object.java:429)
at sun.awt.AWTAutoShutdown.run(AWTAutoShutdown.java:2 59)
- locked <0x45b3ee78> (a java.lang.Object)
at java.lang.Thread.run(Thread.java:534)

"Ping Thread" prio=1 tid=0x08140480 nid=0x4e33 waiting on condition
[59a5e000..59a5e8bc]
at java.lang.Thread.sleep(Native Method)
at com.atecom.lib.util.Misc.sleep(Misc.java:773)
at
com.atecom.maya.client.adminserver.PingThread.run( PingThread.java:70)

"DestroyJavaVM" prio=1 tid=0x080529e8 nid=0x4e33 waiting on condition
[0..bfffbe84]

"LogLevelThread" prio=1 tid=0x0813dc48 nid=0x4e33 in Object.wait()
[593ca000..593ca8bc]
at java.lang.Object.wait(Native Method)
- waiting on <0x45b3a0a8> (a
de.qfs.lib.log.LogLevels$LogLevelThread)
at java.lang.Object.wait(Object.java:429)
at de.qfs.lib.log.LogLevels$LogLevelThread.run(LogLev els.java:869)
- locked <0x45b3a0a8> (a de.qfs.lib.log.LogLevels$LogLevelThread)

"Signal Dispatcher" daemon prio=1 tid=0x080909e8 nid=0x4e33 waiting on
condition [0..0]

"JDWP Event Helper Thread" daemon prio=1 tid=0x0808f228 nid=0x4e33
runnable [0..0]

"JDWP Transport Listener: dt_socket" daemon prio=1 tid=0x0808e6f0
nid=0x4e33 runnable [0..58b70610]

"Finalizer" daemon prio=1 tid=0x08089f20 nid=0x4e33 in Object.wait()
[58a08000..58a088bc]
at java.lang.Object.wait(Native Method)
- waiting on <0x45b1afd8> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue .java:111)
- locked <0x45b1afd8> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue .java:127)
at java.lang.ref.Finalizer$FinalizerThread.run(Finali zer.java:159)

"Reference Handler" daemon prio=1 tid=0x08088408 nid=0x4e33 in
Object.wait() [58988000..589888bc]
at java.lang.Object.wait(Native Method)
- waiting on <0x45b1aff8> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:429)
at java.lang.ref.Reference$ReferenceHandler.run(Refer ence.java:115)
- locked <0x45b1aff8> (a java.lang.ref.Reference$Lock)

"VM Thread" prio=1 tid=0x08087108 nid=0x4e33 runnable

"VM Periodic Task Thread" prio=1 tid=0x08093528 nid=0x4e33 waiting on
condition
"Suspend Checker Thread" prio=1 tid=0x0808ff30 nid=0x4e33 runnable
Jul 17 '05 #1
2 4759
P.Xman wrote:

Hi all,

I have a strange behaviour where the AppContext.get() is waiting for
lock of a HashMap that is not locked by any other task. This freezes my
GUI because the AWT-EventQueue wants to stop a javax.swing.Timer that is
locked by the TimerQueue Thread that is waiting for the HashMap.

I have no idea how to catch problem. Am I am doing something wrong with
the timer? Any hint how I can get more information about the reason? Any
workaround?


The stacktrace doesn't really indicate a deadlock situation. Could also be
a condition wherein you are using far too many timers and thus starving the
EDT ??? (The javadoc comment of the postExpiredTimers method of the TimerQueue
class seems to indicate that this could happen if there are a lots of timers)

Also check your threads that are in sleep() state to see if they are holding any
locks.

BK
Jul 17 '05 #2
Thanks for your answer.
The stacktrace doesn't really indicate a deadlock situation.
=> thats why I called it 'invisible'
Could also be a condition wherein you are using far too many timers
and thus starving the
EDT ??? (The javadoc comment of the postExpiredTimers method of the
TimerQueue
class seems to indicate that this could happen if there are a lots of
timers)
=> my app creates directly about 10 timer in a range between 1 and 3
seconds - I think that's not the problem.
Also check your threads that are in sleep() state to see if they are
holding any
locks.


=> I checked this with eclipse - no locks to see. Can I get more Info
than eclipse or the dump offers?

In the freeze situation my App uses less than 1% CPU time - no
indication for a loop situation.

I have removed most of the Timer.stop() to see if it works now better.
I am not in the office the next 14 days - vacation :-) - I'll report
about the result when I am back.

Peter
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Robert Brown | last post: by
3 posts views Thread by Nigel Robbins | last post: by
15 posts views Thread by Zeng | last post: by
2 posts views Thread by Sumanth | last post: by
27 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.