2

I currently have an applet and only recently discovered a problem with it, sometimes the whole JVM locks up and becomes unresponsive including the Java console.

Any code in the Applet that I have that updates the UI is run on the event dispatch thread. When the JVM Locked I used JVisualVM to provide a Thread Dump of the JVM. I enclose the output it below. From what I can see is that there are 3 Event Queues, but more worrying is that I think there are 2 EventDispatch threads running and mutually blocking each other in a Deadly Embrace.

The scenario in the applet is as follows, the user wishes to browse on a textfield so we launch the browse window hosted within a JInternalFrame window, the user selects the value they want and then that value is inserted into the TextField and the browse window is dismissed.

From what I can see is that thread AWT-EventQueue-2 is updating the field on the EDT and has acquired the writeLock in javax.swing.text.AbstractDocument.replace() and tries to invalidate the textfield but waits until thread AWT-EventQueue-0 releases the Treelock, however AWT-EventQueue-0 is waiting on a readlock() on the same field but wont progress until the thread AWT-EventQueue-2 releases the writelock, hence the mutual locking. What I dont understand is it appears as if there are at least 2 EDT.

I know Im probaly being stupid here but can anyone shed any light on this issue. Thanks in advance.

My Question here is, do you think this is a JVM bug

The Threads of interest here are AWT-EventQueue-1, AWT-EventQueue-2 and AWT-EventQueue-0.

2011-05-26 12:32:43
Full thread dump Java HotSpot(TM) Client VM (19.0-b09 mixed mode, sharing):

"JMX server connection timeout 1480" daemon prio=6 tid=0x048d0800 nid=0xbac in Object.wait() [0x056ef000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at com.sun.jmx.remote.internal.ServerCommunicatorAdmin$Timeout.run(Unknown Source)
    - locked  (a [I)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"RMI Scheduler(0)" daemon prio=6 tid=0x04a72800 nid=0xf74 waiting on condition [0x047cf000]
   java.lang.Thread.State: TIMED_WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for   (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
    at java.util.concurrent.locks.LockSupport.parkNanos(Unknown Source)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(Unknown Source)
    at java.util.concurrent.DelayQueue.take(Unknown Source)
    at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source)
    at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"RMI TCP Connection(2)-172.16.10.136" daemon prio=6 tid=0x0494c800 nid=0x7b8 runnable [0x0462f000]
   java.lang.Thread.State: RUNNABLE
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(Unknown Source)
    at java.io.BufferedInputStream.fill(Unknown Source)
    at java.io.BufferedInputStream.read(Unknown Source)
    - locked  (a java.io.BufferedInputStream)
    at java.io.FilterInputStream.read(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    -  (a java.util.concurrent.locks.ReentrantLock$NonfairSync)

"RMI TCP Accept-0" daemon prio=6 tid=0x050b0400 nid=0x860 runnable [0x036df000]
   java.lang.Thread.State: RUNNABLE
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.PlainSocketImpl.accept(Unknown Source)
    - locked  (a java.net.SocksSocketImpl)
    at java.net.ServerSocket.implAccept(Unknown Source)
    at java.net.ServerSocket.accept(Unknown Source)
    at sun.management.jmxremote.LocalRMIServerSocketFactory$1.accept(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"NativeSwing Receiver - Swing" daemon prio=4 tid=0x04aafc00 nid=0x164 runnable [0x0471f000]
   java.lang.Thread.State: RUNNABLE
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(Unknown Source)
    at java.io.BufferedInputStream.fill(Unknown Source)
    at java.io.BufferedInputStream.read(Unknown Source)
    - locked  (a java.io.BufferedInputStream)
    at java.io.ObjectInputStream$PeekInputStream.peek(Unknown Source)
    at java.io.ObjectInputStream$BlockDataInputStream.peek(Unknown Source)
    at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readUnshared(Unknown Source)
    at chrriis.dj.nativeswing.swtimpl.OutProcessSocketsMessagingInterface.readMessageFromChannel(OutProcessSocketsMessagingInterface.java:113)
    at chrriis.dj.nativeswing.swtimpl.MessagingInterface$2.run(MessagingInterface.java:361)

   Locked ownable synchronizers:
    - None

"NativeSwing Stream Connector" daemon prio=4 tid=0x04915800 nid=0xf04 runnable [0x0569f000]
   java.lang.Thread.State: RUNNABLE
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(Unknown Source)
    at java.io.BufferedInputStream.fill(Unknown Source)
    at java.io.BufferedInputStream.read1(Unknown Source)
    at java.io.BufferedInputStream.read(Unknown Source)
    - locked  (a java.io.BufferedInputStream)
    at java.io.FilterInputStream.read(Unknown Source)
    at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess$1.run(NativeInterface.java:801)

   Locked ownable synchronizers:
    - None

"NativeSwing Stream Connector" daemon prio=4 tid=0x03330400 nid=0xe24 runnable [0x0564f000]
   java.lang.Thread.State: RUNNABLE
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(Unknown Source)
    at java.io.BufferedInputStream.read1(Unknown Source)
    at java.io.BufferedInputStream.read(Unknown Source)
    - locked  (a java.io.BufferedInputStream)
    at java.io.BufferedInputStream.fill(Unknown Source)
    at java.io.BufferedInputStream.read1(Unknown Source)
    at java.io.BufferedInputStream.read(Unknown Source)
    - locked  (a java.io.BufferedInputStream)
    at java.io.FilterInputStream.read(Unknown Source)
    at chrriis.dj.nativeswing.swtimpl.NativeInterface$OutProcess$1.run(NativeInterface.java:801)

   Locked ownable synchronizers:
    - None

"WebServer" daemon prio=4 tid=0x0489b400 nid=0xfc8 runnable [0x055ff000]
   java.lang.Thread.State: RUNNABLE
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.PlainSocketImpl.accept(Unknown Source)
    - locked  (a java.net.SocksSocketImpl)
    at java.net.ServerSocket.implAccept(Unknown Source)
    at java.net.ServerSocket.accept(Unknown Source)
    at chrriis.common.WebServer$1.run(WebServer.java:720)

   Locked ownable synchronizers:
    - None

"Registry cleanup thread" daemon prio=4 tid=0x04ad9400 nid=0xf94 waiting on condition [0x055af000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
    at java.lang.Thread.sleep(Native Method)
    at chrriis.common.ObjectRegistry$1.run(ObjectRegistry.java:31)

   Locked ownable synchronizers:
    - None

"Registry cleanup thread" daemon prio=4 tid=0x04c37400 nid=0x2e4 waiting on condition [0x054df000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
    at java.lang.Thread.sleep(Native Method)
    at chrriis.common.ObjectRegistry$1.run(ObjectRegistry.java:31)

   Locked ownable synchronizers:
    - None

"TimerQueue" daemon prio=4 tid=0x03378000 nid=0xa0 in Object.wait() [0x0486f000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at javax.swing.TimerQueue.run(Unknown Source)
    - locked  (a javax.swing.TimerQueue)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"ConsoleWriterThread" daemon prio=6 tid=0x032b1400 nid=0x398 in Object.wait() [0x0476f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at com.sun.deploy.util.ConsoleTraceListener$ConsoleWriterThread.run(Unknown Source)
    - locked  (a java.lang.Object)

   Locked ownable synchronizers:
    - None

"Windows Tray Icon Thread" prio=6 tid=0x032a7800 nid=0xdbc runnable [0x046cf000]
   java.lang.Thread.State: RUNNABLE
    at com.sun.deploy.ui.WindowsJavaTrayIcon.mainLoop(Native Method)
    at com.sun.deploy.ui.WindowsJavaTrayIcon.access$700(Unknown Source)
    at com.sun.deploy.ui.WindowsJavaTrayIcon$2.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"TimerQueue" daemon prio=6 tid=0x032a2800 nid=0xf78 in Object.wait() [0x0467f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on  (a javax.swing.TimerQueue)
    at javax.swing.TimerQueue.run(Unknown Source)
    - locked  (a javax.swing.TimerQueue)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"thread applet-ClientApplet.class-1" prio=4 tid=0x03281400 nid=0x85c in Object.wait() [0x045df000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on  (a java.lang.Object)
    at java.lang.Object.wait(Object.java:485)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    - locked  (a java.lang.Object)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"AWT-EventQueue-1" prio=6 tid=0x0325b400 nid=0xe94 waiting for monitor entry [0x0457f000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - waiting to lock  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintToOffscreen(Unknown Source)
    at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
    at javax.swing.RepaintManager.paint(Unknown Source)
    at javax.swing.JComponent._paintImmediately(Unknown Source)
    at javax.swing.JComponent.paintImmediately(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"AWT-EventQueue-2" prio=4 tid=0x03259800 nid=0xb0c waiting for monitor entry [0x0363f000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at java.awt.Component.invalidate(Unknown Source)
    - waiting to lock  (a java.awt.Component$AWTTreeLock)
    at java.awt.Container.invalidate(Unknown Source)
    at javax.swing.JComponent.revalidate(Unknown Source)
    at javax.swing.plaf.basic.BasicTextUI$RootView.preferenceChanged(Unknown Source)
    at javax.swing.text.View.preferenceChanged(Unknown Source)
    at javax.swing.text.PlainView.updateDamage(Unknown Source)
    at javax.swing.text.PlainView.removeUpdate(Unknown Source)
    at javax.swing.text.FieldView.removeUpdate(Unknown Source)
    at javax.swing.plaf.basic.BasicTextUI$RootView.removeUpdate(Unknown Source)
    at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.removeUpdate(Unknown Source)
    at javax.swing.text.AbstractDocument.fireRemoveUpdate(Unknown Source)
    at javax.swing.text.AbstractDocument.handleRemove(Unknown Source)
    at javax.swing.text.AbstractDocument.remove(Unknown Source)
    at javax.swing.text.AbstractDocument.replace(Unknown Source)
    at javax.swing.text.JTextComponent.setText(Unknown Source)
    at JCFTextField.setFieldData(Unknown Source)
    at JCFTextField.JC_setData(Unknown Source)
    at CTetraAppCommsCallBack.JC_SetData(Unknown Source)
    at ClientCommsManager.processComponentMsg(Unknown Source)
    at ClientCommsManager.commsInput(Unknown Source)
    at HTTPCommsThread$2.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"Applet 1 LiveConnect Worker Thread" prio=4 tid=0x03261800 nid=0xe3c in Object.wait() [0x044df000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$LiveConnectWorker.run(Unknown Source)
    - locked  (a java.lang.Object)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"Browser Side Object Cleanup Thread" prio=6 tid=0x03255800 nid=0x29c in Object.wait() [0x037ff000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on  (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    - locked  (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    at sun.plugin2.main.client.LiveConnectSupport$BrowserSideObjectCleanupThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"CacheCleanUpThread" daemon prio=6 tid=0x0322d000 nid=0x86c in Object.wait() [0x0377f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on  (a com.sun.deploy.cache.CleanupThread)
    at java.lang.Object.wait(Object.java:485)
    at com.sun.deploy.cache.CleanupThread.run(Unknown Source)
    - locked  (a com.sun.deploy.cache.CleanupThread)

   Locked ownable synchronizers:
    - None

"CacheMemoryCleanUpThread" daemon prio=6 tid=0x03227c00 nid=0x554 in Object.wait() [0x0372f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    - locked  (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    at com.sun.deploy.cache.MemoryCache$LoadedResourceCleanupThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"Java Plug-In Heartbeat Thread" prio=6 tid=0x02d66c00 nid=0xdcc waiting on condition [0x034af000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
    at java.lang.Thread.sleep(Native Method)
    at sun.plugin2.main.client.PluginMain$HeartbeatThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"AWT-EventQueue-0" prio=6 tid=0x02d6e400 nid=0xd9c in Object.wait() [0x0368d000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at javax.swing.text.AbstractDocument.readLock(Unknown Source)
    - locked  (a javax.swing.text.PlainDocument)
    at javax.swing.plaf.basic.BasicTextUI.paint(Unknown Source)
    at javax.swing.plaf.basic.BasicTextUI.update(Unknown Source)
    at javax.swing.JComponent.paintComponent(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JLayeredPane.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JLayeredPane.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JLayeredPane.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JViewport.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JLayeredPane.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JLayeredPane.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JSplitPane.paintChildren(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    - locked  (a java.awt.Component$AWTTreeLock)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintToOffscreen(Unknown Source)
    at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
    at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
    at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
    at javax.swing.RepaintManager.paint(Unknown Source)
    at javax.swing.JComponent._paintImmediately(Unknown Source)
    at javax.swing.JComponent.paintImmediately(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"AWT-Windows" daemon prio=6 tid=0x02cea800 nid=0x568 runnable [0x00a2f000]
   java.lang.Thread.State: RUNNABLE
    at sun.awt.windows.WToolkit.eventLoop(Native Method)
    at sun.awt.windows.WToolkit.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"AWT-Shutdown" prio=6 tid=0x02ce9c00 nid=0x608 in Object.wait() [0x0359f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at sun.awt.AWTAutoShutdown.run(Unknown Source)
    - locked  (a java.lang.Object)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"Java2D Disposer" daemon prio=10 tid=0x02ccb800 nid=0x524 in Object.wait() [0x0354f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    - locked  (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    at sun.java2d.Disposer.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"Java Plug-In Pipe Worker Thread (Client-Side)" daemon prio=6 tid=0x0321c400 nid=0xbec runnable [0x034ff000]
   java.lang.Thread.State: RUNNABLE
    at sun.plugin2.os.windows.Windows.ReadFile0(Native Method)
    at sun.plugin2.os.windows.Windows.ReadFile(Unknown Source)
    at sun.plugin2.ipc.windows.WindowsNamedPipe.read(Unknown Source)
    at sun.plugin2.message.transport.NamedPipeTransport$SerializerImpl.read(Unknown Source)
    at sun.plugin2.message.transport.NamedPipeTransport$SerializerImpl.readByte(Unknown Source)
    at sun.plugin2.message.AbstractSerializer.readInt(Unknown Source)
    at sun.plugin2.message.transport.SerializingTransport.read(Unknown Source)
    at sun.plugin2.message.Pipe$WorkerThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"Timer-0" prio=6 tid=0x02d65c00 nid=0x4e8 in Object.wait() [0x0345f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on  (a java.util.TaskQueue)
    at java.lang.Object.wait(Object.java:485)
    at java.util.TimerThread.mainLoop(Unknown Source)
    - locked  (a java.util.TaskQueue)
    at java.util.TimerThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"traceMsgQueueThread" daemon prio=6 tid=0x02cef400 nid=0xb14 in Object.wait() [0x031cf000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at com.sun.deploy.util.Trace$TraceMsgQueueChecker.run(Unknown Source)
    - locked  (a java.util.ArrayList)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"Low Memory Detector" daemon prio=6 tid=0x02c9e400 nid=0x834 runnable [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
    - None

"CompilerThread0" daemon prio=10 tid=0x02c98800 nid=0xf0c waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
    - None

"Attach Listener" daemon prio=10 tid=0x02c96c00 nid=0xec waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
    - None

"Signal Dispatcher" daemon prio=10 tid=0x02c95800 nid=0x464 runnable [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
    - None

"Finalizer" daemon prio=8 tid=0x02c8e800 nid=0x900 in Object.wait() [0x02e5f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    - locked  (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"Reference Handler" daemon prio=10 tid=0x02c8d400 nid=0x71c in Object.wait() [0x02e0f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)
    - locked  (a java.lang.ref.Reference$Lock)

   Locked ownable synchronizers:
    - None

"main" prio=6 tid=0x002a8000 nid=0x380 in Object.wait() [0x0090f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at sun.plugin2.message.Queue.waitForMessage(Unknown Source)
    - locked  (a sun.plugin2.message.Queue)
    at sun.plugin2.message.Pipe.receive(Unknown Source)
    at sun.plugin2.main.client.PluginMain.mainLoop(Unknown Source)
    at sun.plugin2.main.client.PluginMain.run(Unknown Source)
    at sun.plugin2.main.client.PluginMain.main(Unknown Source)

   Locked ownable synchronizers:
    - None

"VM Thread" prio=10 tid=0x02c8bc00 nid=0x814 runnable 

"VM Periodic Task Thread" prio=10 tid=0x02ca9400 nid=0x4bc waiting on condition 

JNI global references: 2569
8
  • So as you saw, you have a blocking lock where AWT 1 and 2 are waiting on the operation in AWT-0 to get the readLock on the AbstractDocument. Have you taken multiple thread dumps back to back? space them out over 10 sec. does the same result occur for those 3 threads? How long does this lock hold?
    – Sean
    May 31, 2011 at 12:24
  • Hi Sean, Firstly thanks for replying so quickly. With regard to your question it hangs forever, we got the first thread dump after it hung for about 6mins on a customers site. We waited longer but never freed itself up.
    – Vince
    May 31, 2011 at 13:01
  • ok, 6 minutes is a long time. Blocking locks aren't uncommon they just normally resolve themselves (fractions of a second) before you ever notice. Let me look some more @ the culprit thread
    – Sean
    May 31, 2011 at 13:03
  • I did find this bug bugs.sun.com/bugdatabase/view_bug.do?bug_id=6665129 check your version of java as there appears to be a fix in the later 6 versions. not sure if they are directly related or not
    – Sean
    May 31, 2011 at 13:13
  • Also, to confirm since I see the work being done in the AWT-0 thread, you invoke the swing components with the SwingUtils?
    – Sean
    May 31, 2011 at 13:19

1 Answer 1

0

The Java concurrency trail explains that acess to Swing components and their models need to happen on the EDT. However, it fails to address what happens when you have multiple EDTs.

A better phrasing of "always access swing components from the EDT" is probably: "always access swing components from exactly one EDT".

The chrriis.dj.nativeswing.swtimpl classes the applet is using in its JInternalFrame are creating another EDT.

The deadlock is happening when the EDT#2 (the inner frame) is updating the text field and, at the same time, EDT#0 (the applet) is attempting to repaint the same text field.

The solution is to not pass any Swing component or their models between EDTs. Instead use a BlockingQueue with the inner frame as the producer and a SwingWorker (started by the applet) as the consumer. Once the SwingWorker reads the update from the BlockingQueue, it can pass the data back to its EDT via its done method. If you need to post intermediate results, use the publish and process methods

1
  • HI thanks for the very much appreciated input. I have done some further investigating on this issue so i created just a plain basic applet and attached the JVisual VM tool to it. It showed not one but 3 EDT's as before, so in this scenario it can't be the chrriis.dj.nativeswing.swtimpl classes that are adding the extra EDT's. I have logged this issue with Sun oops Oracle and they have accepted this issue as a bug (albeit low priority in their estimation). A big thanks again to everyone who left comments/replies on this issue, they are all very much appreciated.
    – Vince
    Jul 27, 2011 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.