Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6935447

Deadlock in XToolkit's shutdown hook

XMLWordPrintable

    • x86
    • linux

      JDK 6u17, Linux. When running

      http://hg.netbeans.org/core-main/file/1223c455744c/core.windows/test/unit/src/org/netbeans/core/windows/services/NbPresenterTest.java

      the test perhaps took too long and SIGTERM was sent by Ant's JUnit test runner to halt it; it however froze rather than exiting:

      ---%<---
      2010-03-16 20:33:29
      Full thread dump Java HotSpot(TM) Server VM (14.3-b01 mixed mode):

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

      "Thread-1" prio=10 tid=0x0810b400 nid=0x7235 waiting on condition [0xfc9fe000]
         java.lang.Thread.State: WAITING (parking)
      at sun.misc.Unsafe.park(Native Method)
      - parking to wait for <0x65c83ae8> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
      at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:747)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:778)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1114)
      at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:186)
      at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:262)
      at sun.awt.SunToolkit.awtLock(SunToolkit.java:236)
      at sun.awt.X11.XAtom.<init>(XAtom.java:252)
      at sun.awt.X11.XAtom.<init>(XAtom.java:219)
      at sun.awt.X11.XAtom.get(XAtom.java:161)
      at sun.awt.X11.XSystemTrayPeer.<clinit>(XSystemTrayPeer.java:29)
      at sun.awt.X11.XToolkit$2.run(XToolkit.java:256)

      "SIGTERM handler" daemon prio=10 tid=0x08109400 nid=0x7233 in Object.wait() [0xfcdff000]
         java.lang.Thread.State: WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)
      - waiting on <0x65c83c90> (a sun.awt.X11.XToolkit$2)
      at java.lang.Thread.join(Thread.java:1143)
      - locked <0x65c83c90> (a sun.awt.X11.XToolkit$2)
      at java.lang.Thread.join(Thread.java:1196)
      at java.lang.ApplicationShutdownHooks.runHooks(ApplicationShutdownHooks.java:79)
      at java.lang.ApplicationShutdownHooks$1.run(ApplicationShutdownHooks.java:24)
      at java.lang.Shutdown.runHooks(Shutdown.java:79)
      at java.lang.Shutdown.sequence(Shutdown.java:123)
      at java.lang.Shutdown.exit(Shutdown.java:168)
      - locked <0x5983e480> (a java.lang.Class for java.lang.Shutdown)
      at java.lang.Terminator$1.handle(Terminator.java:35)
      at sun.misc.Signal$1.run(Signal.java:195)
      at java.lang.Thread.run(Thread.java:619)

      "Active Reference Queue Daemon" daemon prio=10 tid=0x7a0ed400 nid=0x6a72 in Object.wait() [0xfcfff000]
         java.lang.Thread.State: WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)
      - waiting on <0x65c4eda0> (a java.lang.ref.ReferenceQueue$Lock)
      at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
      - locked <0x65c4eda0> (a java.lang.ref.ReferenceQueue$Lock)
      at org.openide.util.lookup.implspi.ActiveQueue$Impl.run(ActiveQueue.java:62)
      at java.lang.Thread.run(Thread.java:619)

      "Timer-0" daemon prio=10 tid=0x7a007000 nid=0x6a71 in Object.wait() [0xfd1ff000]
         java.lang.Thread.State: WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)
      - waiting on <0x65c4ee38> (a java.util.TaskQueue)
      at java.lang.Object.wait(Object.java:485)
      at java.util.TimerThread.mainLoop(Timer.java:483)
      - locked <0x65c4ee38> (a java.util.TaskQueue)
      at java.util.TimerThread.run(Timer.java:462)

      "AWT-EventQueue-0" prio=10 tid=0x7a0eb800 nid=0x6a70 runnable [0xfd3fe000]
         java.lang.Thread.State: RUNNABLE
      at sun.awt.X11.XlibWrapper.XQueryTree(Native Method)
      at sun.awt.X11.XQueryTree.execute(XQueryTree.java:42)
      at sun.awt.X11.XQueryTree.execute(XQueryTree.java:26)
      at sun.awt.X11.XComponentPeer.restack(XComponentPeer.java:1443)
      - locked <0x65c480e8> (a java.awt.Component$AWTTreeLock)
      at java.awt.Component.addNotify(Component.java:6686)
      - locked <0x65c480e8> (a java.awt.Component$AWTTreeLock)
      at java.awt.Container.addNotify(Container.java:2567)
      - locked <0x65c480e8> (a java.awt.Component$AWTTreeLock)
      at java.awt.Window.addNotify(Window.java:662)
      - locked <0x65c480e8> (a java.awt.Component$AWTTreeLock)
      at java.awt.Dialog.addNotify(Dialog.java:742)
      - locked <0x65c480e8> (a java.awt.Component$AWTTreeLock)
      at org.netbeans.core.windows.services.NbPresenter.addNotify(NbPresenter.java:430)
      at java.awt.Window.pack(Window.java:703)
      at org.netbeans.core.windows.services.NbPresenter.initialize(NbPresenter.java:254)
      at org.netbeans.core.windows.services.NbPresenter.<init>(NbPresenter.java:184)
      at org.netbeans.core.windows.services.NbDialog.<init>(NbDialog.java:64)
      at org.netbeans.core.windows.services.NbPresenterTest.testNbPresenterComparator(NbPresenterTest.java:162)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at junit.framework.TestCase.runTest(TestCase.java:168)
      at org.netbeans.junit.NbTestCase.access$200(NbTestCase.java:89)
      at org.netbeans.junit.NbTestCase$2.doSomething(NbTestCase.java:345)
      at org.netbeans.junit.NbTestCase$1Guard.run(NbTestCase.java:274)
      at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

      "AWT-Shutdown" prio=10 tid=0x7a0ea800 nid=0x6a6f in Object.wait() [0xfd5ff000]
         java.lang.Thread.State: WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)
      - waiting on <0x65c5eb68> (a java.lang.Object)
      at java.lang.Object.wait(Object.java:485)
      at sun.awt.AWTAutoShutdown.run(AWTAutoShutdown.java:259)
      - locked <0x65c5eb68> (a java.lang.Object)
      at java.lang.Thread.run(Thread.java:619)

      "AWT-XAWT" daemon prio=10 tid=0x7a0ea000 nid=0x6a6e waiting on condition [0xfd7fe000]
         java.lang.Thread.State: WAITING (parking)
      at sun.misc.Unsafe.park(Native Method)
      - parking to wait for <0x65c83ae8> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
      at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:747)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:778)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1114)
      at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:186)
      at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:262)
      at sun.awt.SunToolkit.awtLock(SunToolkit.java:236)
      at sun.awt.X11.XToolkit.waitForEvents(Native Method)
      at sun.awt.X11.XToolkit.run(XToolkit.java:548)
      at sun.awt.X11.XToolkit.run(XToolkit.java:523)
      at java.lang.Thread.run(Thread.java:619)

      "Java2D Disposer" daemon prio=10 tid=0x08298c00 nid=0x6a6d in Object.wait() [0xfd9ff000]
         java.lang.Thread.State: WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)
      - waiting on <0x65c5ef10> (a java.lang.ref.ReferenceQueue$Lock)
      at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
      - locked <0x65c5ef10> (a java.lang.ref.ReferenceQueue$Lock)
      at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)
      at sun.java2d.Disposer.run(Disposer.java:125)
      at java.lang.Thread.run(Thread.java:619)

      "Low Memory Detector" daemon prio=10 tid=0x7a014400 nid=0x6a6b runnable [0x00000000]
         java.lang.Thread.State: RUNNABLE

      "CompilerThread1" daemon prio=10 tid=0x7a012000 nid=0x6a6a waiting on condition [0x00000000]
         java.lang.Thread.State: RUNNABLE

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

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

      "Finalizer" daemon prio=10 tid=0x08104400 nid=0x6a67 in Object.wait() [0xfe5ff000]
         java.lang.Thread.State: WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)
      - waiting on <0x77ec0018> (a java.lang.ref.ReferenceQueue$Lock)
      at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
      - locked <0x77ec0018> (a java.lang.ref.ReferenceQueue$Lock)
      at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)
      at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

      "Reference Handler" daemon prio=10 tid=0x08102c00 nid=0x6a66 in Object.wait() [0xfe7ff000]
         java.lang.Thread.State: WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)
      - waiting on <0x65c2f310> (a java.lang.ref.Reference$Lock)
      at java.lang.Object.wait(Object.java:485)
      at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
      - locked <0x65c2f310> (a java.lang.ref.Reference$Lock)

      "main" prio=10 tid=0x0805fc00 nid=0x6a60 in Object.wait() [0xff3ff000]
         java.lang.Thread.State: WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)
      - waiting on <0x77941d08> (a org.netbeans.junit.NbTestCase$2)
      at org.netbeans.junit.NbTestCase$1Guard.waitFinished(NbTestCase.java:294)
      - locked <0x77941d08> (a org.netbeans.junit.NbTestCase$2)
      at org.netbeans.junit.NbTestCase.runBare(NbTestCase.java:360)
      at junit.framework.TestResult$1.protect(TestResult.java:110)
      at junit.framework.TestResult.runProtected(TestResult.java:128)
      at junit.framework.TestResult.run(TestResult.java:113)
      at junit.framework.TestCase.run(TestCase.java:124)
      at org.netbeans.junit.NbTestCase.run(NbTestCase.java:214)
      at junit.framework.TestSuite.runTest(TestSuite.java:232)
      at junit.framework.TestSuite.run(TestSuite.java:227)
      at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
      at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
      at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:422)
      at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:931)
      at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:785)

      "VM Thread" prio=10 tid=0x080fec00 nid=0x6a65 runnable

      "GC task thread#0 (ParallelGC)" prio=10 tid=0x08066800 nid=0x6a61 runnable

      "GC task thread#1 (ParallelGC)" prio=10 tid=0x08067c00 nid=0x6a62 runnable

      "GC task thread#2 (ParallelGC)" prio=10 tid=0x08069400 nid=0x6a63 runnable

      "GC task thread#3 (ParallelGC)" prio=10 tid=0x0806a800 nid=0x6a64 runnable

      "VM Periodic Task Thread" prio=10 tid=0x7a016400 nid=0x6a6c waiting on condition

      JNI global references: 1126
      ---%<---

      This code does not use the system tray to my knowledge.
      Similar deadlock closing org.netbeans.core.output2.IOExtensionsTest in JDK 6u31, causing continuous integration to hang:

      Full thread dump Java HotSpot(TM) 64-Bit Server VM (20.6-b01 mixed mode):

      "Attach Listener" daemon prio=10 tid=0x00007f5fd0002000 nid=0x5ef2 waiting on condition [0x0000000000000000]
         java.lang.Thread.State: RUNNABLE

      "SIGTERM handler" daemon prio=10 tid=0x00007f5fd0001000 nid=0x578d waiting for monitor entry [0x00007f5fd5671000]
         java.lang.Thread.State: BLOCKED (on object monitor)
      at java.lang.Shutdown.exit(Shutdown.java:168)
      - waiting to lock <0x00000000dff023d0> (a java.lang.Class for java.lang.Shutdown)
      at java.lang.Terminator$1.handle(Terminator.java:35)
      at sun.misc.Signal$1.run(Signal.java:195)
      at java.lang.Thread.run(Thread.java:662)

      "XToolkit-Shutdown-Thread" prio=10 tid=0x00007f5ffc279000 nid=0x5698 runnable [0x00007f5fd536d000]
         java.lang.Thread.State: RUNNABLE
      at sun.awt.X11.XlibWrapper.InternAtom(Native Method)
      at sun.awt.X11.XAtom.<init>(XAtom.java:254)
      at sun.awt.X11.XAtom.<init>(XAtom.java:219)
      at sun.awt.X11.XAtom.get(XAtom.java:161)
      at sun.awt.X11.XSystemTrayPeer.<clinit>(XSystemTrayPeer.java:29)
      at sun.awt.X11.XToolkit$1$1.run(XToolkit.java:283)

      "TimerQueue" daemon prio=10 tid=0x00007f5fb408a800 nid=0x568e in Object.wait() [0x00007f5fd5772000]
         java.lang.Thread.State: WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)
      - waiting on <0x00000000fa106f88> (a javax.swing.TimerQueue)
      at javax.swing.TimerQueue.run(TimerQueue.java:232)
      - locked <0x00000000fa106f88> (a javax.swing.TimerQueue)
      at java.lang.Thread.run(Thread.java:662)

      "Active Reference Queue Daemon" daemon prio=10 tid=0x00007f5fb405d000 nid=0x568b in Object.wait() [0x00007f5fd5974000]
         java.lang.Thread.State: TIMED_WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)
      - waiting on <0x00000000f9f84bd8> (a java.lang.ref.ReferenceQueue$Lock)
      at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
      - locked <0x00000000f9f84bd8> (a java.lang.ref.ReferenceQueue$Lock)
      at org.openide.util.lookup.implspi.ActiveQueue$Daemon.run(ActiveQueue.java:174)
      - locked <0x00000000f9f84bd8> (a java.lang.ref.ReferenceQueue$Lock)

      "AWT-XAWT" daemon prio=10 tid=0x00007f5ffc262800 nid=0x5688 waiting on condition [0x00007f5fd5c76000]
         java.lang.Thread.State: WAITING (parking)
      at sun.misc.Unsafe.park(Native Method)
      - parking to wait for <0x00000000f99f39e0> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
      at java.util.concurrent.locks.LockSupport.park(LockSupport.java:156)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:811)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:842)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1178)
      at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:186)
      at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:262)
      at sun.awt.SunToolkit.awtLock(SunToolkit.java:234)
      at sun.awt.X11.XToolkit.waitForEvents(Native Method)
      at sun.awt.X11.XToolkit.run(XToolkit.java:579)
      at sun.awt.X11.XToolkit.run(XToolkit.java:543)
      at java.lang.Thread.run(Thread.java:662)

      "Java2D Disposer" daemon prio=10 tid=0x00007f5ffc21e000 nid=0x5687 in Object.wait() [0x00007f5fd5e80000]
         java.lang.Thread.State: WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)
      - waiting on <0x00000000f9a1a840> (a java.lang.ref.ReferenceQueue$Lock)
      at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
      - locked <0x00000000f9a1a840> (a java.lang.ref.ReferenceQueue$Lock)
      at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)
      at sun.java2d.Disposer.run(Disposer.java:127)
      at java.lang.Thread.run(Thread.java:662)

      "Low Memory Detector" daemon prio=10 tid=0x00007f5ffc092800 nid=0x5685 runnable [0x0000000000000000]
         java.lang.Thread.State: RUNNABLE

      "C2 CompilerThread1" daemon prio=10 tid=0x00007f5ffc090800 nid=0x5684 waiting on condition [0x0000000000000000]
         java.lang.Thread.State: RUNNABLE

      "C2 CompilerThread0" daemon prio=10 tid=0x00007f5ffc08d800 nid=0x5683 waiting on condition [0x0000000000000000]
         java.lang.Thread.State: RUNNABLE

      "Signal Dispatcher" daemon prio=10 tid=0x00007f5ffc08b800 nid=0x5682 runnable [0x0000000000000000]
         java.lang.Thread.State: RUNNABLE

      "Finalizer" daemon prio=10 tid=0x00007f5ffc06f000 nid=0x5681 in Object.wait() [0x00007f5ff89f8000]
         java.lang.Thread.State: WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)
      - waiting on <0x00000000f9561300> (a java.lang.ref.ReferenceQueue$Lock)
      at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
      - locked <0x00000000f9561300> (a java.lang.ref.ReferenceQueue$Lock)
      at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)
      at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

      "Reference Handler" daemon prio=10 tid=0x00007f5ffc06d000 nid=0x5680 in Object.wait() [0x00007f5ff8af9000]
         java.lang.Thread.State: WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)
      - waiting on <0x00000000f95611d8> (a java.lang.ref.Reference$Lock)
      at java.lang.Object.wait(Object.java:485)
      at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
      - locked <0x00000000f95611d8> (a java.lang.ref.Reference$Lock)

      "main" prio=10 tid=0x00007f5ffc008800 nid=0x5679 in Object.wait() [0x00007f6000eda000]
         java.lang.Thread.State: WAITING (on object monitor)
      at java.lang.Object.wait(Native Method)
      - waiting on <0x00000000f9a5d600> (a sun.awt.X11.XToolkit$1$1)
      at java.lang.Thread.join(Thread.java:1186)
      - locked <0x00000000f9a5d600> (a sun.awt.X11.XToolkit$1$1)
      at java.lang.Thread.join(Thread.java:1239)
      at java.lang.ApplicationShutdownHooks.runHooks(ApplicationShutdownHooks.java:79)
      at java.lang.ApplicationShutdownHooks$1.run(ApplicationShutdownHooks.java:24)
      at java.lang.Shutdown.runHooks(Shutdown.java:79)
      at java.lang.Shutdown.sequence(Shutdown.java:123)
      at java.lang.Shutdown.exit(Shutdown.java:168)
      - locked <0x00000000dff023d0> (a java.lang.Class for java.lang.Shutdown)
      at java.lang.Runtime.exit(Runtime.java:90)
      at java.lang.System.exit(System.java:904)
      at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:791)

      "VM Thread" prio=10 tid=0x00007f5ffc066800 nid=0x567f runnable

      "GC task thread#0 (ParallelGC)" prio=10 tid=0x00007f5ffc01b800 nid=0x567b runnable

      "GC task thread#1 (ParallelGC)" prio=10 tid=0x00007f5ffc01d800 nid=0x567c runnable

      "GC task thread#2 (ParallelGC)" prio=10 tid=0x00007f5ffc01f800 nid=0x567d runnable

      "GC task thread#3 (ParallelGC)" prio=10 tid=0x00007f5ffc021000 nid=0x567e runnable

      "VM Periodic Task Thread" prio=10 tid=0x00007f5ffc09d000 nid=0x5686 waiting on condition

      JNI global references: 1368

            arapte Ambarish Rapte
            jglick Jesse Glick (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: