Invisible Deadlock - Java

This is a discussion on Invisible Deadlock - Java ; 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 ...

+ Reply to Thread
Results 1 to 3 of 3

Invisible Deadlock

  1. Default 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(ObjectInputStream.java:2133)
    at
    java.io.ObjectInputStream$BlockDataInputStream.peek(ObjectInputStream.java:2423)
    at
    java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2433)
    at
    java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1245)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
    at
    com.atecom.lib.network.impl.BlockingSocketThread.run(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(SunToolkit.java:543)
    at sun.awt.SunToolkit.getSystemEventQueueImpl(SunToolkit.java:537)
    at java.awt.Toolkit.getEventQueue(Toolkit.java:1519)
    at java.awt.EventQueue.invokeLater(EventQueue.java:792)
    at javax.swing.SwingUtilities.invokeLater(SwingUtilities.java:1170)
    at javax.swing.Timer.post(Timer.java:538)
    - locked <0x45eaade0> (a javax.swing.Timer)
    at javax.swing.TimerQueue.postExpiredTimers(TimerQueue.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(ToolTipManager.java:468)
    at javax.swing.ToolTipManager.mouseEntered(ToolTipManager.java:458)
    at java.awt.Component.processMouseEvent(Component.java:5109)
    at java.awt.Component.processEvent(Component.java:4897)
    at java.awt.Container.processEvent(Container.java:1569)
    at java.awt.Component.dispatchEventImpl(Component.java:3615)
    at java.awt.Container.dispatchEventImpl(Container.java:1627)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at
    java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
    at
    java.awt.LightweightDispatcher.trackMouseEnterExit(Container.java:3323)
    at
    java.awt.LightweightDispatcher.processMouseEvent(Container.java:3180)
    at
    java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
    at java.awt.Container.dispatchEventImpl(Container.java:1613)
    at java.awt.Window.dispatchEventImpl(Window.java:1606)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
    at
    java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
    at
    java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
    at
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
    at
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
    at java.awt.EventDispatchThread.run(EventDispatchThread.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(ClientApplication.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.java:443)
    at
    com.atecom.maya.protocol.AlarmConverter.readAlarm(AlarmConverter.java:98)
    at
    com.atecom.maya.client.alarmserver.ConnectionAlarmServer.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:259)
    - 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(LogLevels.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(Finalizer.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(Reference.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

  2. Default Re: Invisible Deadlock

    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

  3. Default Re: Invisible Deadlock

    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



+ Reply to Thread

Similar Threads

  1. Deadlock detected?
    By Application Development in forum DOTNET
    Replies: 1
    Last Post: 08-14-2007, 06:09 AM
  2. Deadlock issue
    By Application Development in forum DOTNET
    Replies: 0
    Last Post: 06-20-2007, 12:44 PM
  3. Deadlock... i think
    By Application Development in forum Java
    Replies: 2
    Last Post: 03-01-2006, 07:38 AM
  4. CLR Deadlock?
    By Application Development in forum DOTNET
    Replies: 7
    Last Post: 06-30-2005, 03:31 PM
  5. COM Deadlock in W2k but not NT 4.0
    By Application Development in forum Inetserver
    Replies: 1
    Last Post: 07-24-2003, 11:27 AM