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

Deadlock between 'main' and 'AWT-Windows' threads in AWTAutoShutdown

XMLWordPrintable

    • b04
    • other, x86
    • linux, solaris, windows_xp
    • Verified

      The following deadlock was found by JVM while running the test java/awt/print/PrintJob/PrintToDir.java:


      Found one Java-level deadlock:
      =============================
      "AWT-EventQueue-0":
        waiting to lock monitor 0x0aac954c (object 0x02a1ee10, a java.awt.Component$AWTTreeLock),
        which is held by "main"
      "main":
        waiting to lock monitor 0x0aac97bc (object 0x02a25e20, a java.lang.Object),
        which is held by "AWT-Windows"
      "AWT-Windows":
        waiting to lock monitor 0x0aac9754 (object 0x02a25fc8, a java.util.Collections$SynchronizedMap),
        which is held by "main"

      Java stack information for the threads listed above:
      ===================================================
      "AWT-EventQueue-0":
              at sun.awt.windows.WComponentPeer.replaceSurfaceData(WComponentPeer.java:371)
              - waiting to lock <0x02a1ee10> (a java.awt.Component$AWTTreeLock)
              at sun.awt.windows.WComponentPeer.replaceSurfaceData(WComponentPeer.java:360)
              at sun.awt.windows.WComponentPeer$2.run(WComponentPeer.java:408)
              at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:595)
              at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
              at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
      "main":
              at sun.awt.AWTAutoShutdown.notifyPeerMapUpdated(AWTAutoShutdown.java:187)
              - waiting to lock <0x02a25e20> (a java.lang.Object)
              at sun.awt.AWTAutoShutdown$PeerMap.put(AWTAutoShutdown.java:326)
              at java.util.Collections$SynchronizedMap.put(Collections.java:1979)
              - locked <0x02a25fc8> (a java.util.Collections$SynchronizedMap)
              at sun.awt.SunToolkit.targetCreatedPeer(SunToolkit.java:376)
              at sun.awt.windows.WToolkit.createFrame(WToolkit.java:381)
              at java.awt.Frame.addNotify(Frame.java:459)
              - locked <0x02a1ee10> (a java.awt.Component$AWTTreeLock)
              at java.awt.Window.show(Window.java:829)
              at java.awt.Component.show(Component.java:1414)
              at java.awt.Component.setVisible(Component.java:1367)
              at java.awt.Window.setVisible(Window.java:812)
              at PrintToDir.<init>(PrintToDir.java:33)
              at PrintToDir.main(PrintToDir.java:114)
      "AWT-Windows":
              at java.util.Collections$SynchronizedMap.isEmpty(Collections.java:1966)
              - waiting to lock <0x02a25fc8> (a java.util.Collections$SynchronizedMap)
              at sun.awt.AWTAutoShutdown.isReadyToShutdown(AWTAutoShutdown.java:207)
              at sun.awt.AWTAutoShutdown.setToolkitBusy(AWTAutoShutdown.java:236)
              - locked <0x02a25e18> (a java.lang.Object)
              - locked <0x02a25e20> (a java.lang.Object)
              at sun.awt.AWTAutoShutdown.notifyToolkitThreadFree(AWTAutoShutdown.java:132)
              at sun.awt.windows.WToolkit.eventLoop(Native Method)
              at sun.awt.windows.WToolkit.run(WToolkit.java:290)
              at java.lang.Thread.run(Thread.java:619)

      Found 1 deadlock.


      It can be reproduced with one of my builds, but it seems to me that this is only due to some timings shifting and the bug exists in all the 6.0 or 7.0 builds.
      Here is another deadlock that looks related to the previous one:


      Found one Java-level deadlock:
      =============================
      "AWT-EventQueue-1":
        waiting to lock monitor 0x0aa9a2f4 (object 0x02ef16f8, a java.lang.Object),
        which is held by "AWT-Windows"
      "AWT-Windows":
        waiting to lock monitor 0x0aa9a42c (object 0x02ee5c40, a java.util.Collections$SynchronizedMap),
        which is held by "AWT-EventQueue-1"

      Java stack information for the threads listed above:
      ===================================================
      "AWT-EventQueue-1":
              at sun.awt.AWTAutoShutdown.notifyPeerMapUpdated(AWTAutoShutdown.java:187)
              - waiting to lock <0x02ef16f8> (a java.lang.Object)
              at sun.awt.AWTAutoShutdown$PeerMap.remove(AWTAutoShutdown.java:332)
              at java.util.Collections$SynchronizedMap.remove(Collections.java:1982)
              - locked <0x02ee5c40> (a java.util.Collections$SynchronizedMap)
              at sun.awt.SunToolkit.targetDisposedPeer(SunToolkit.java:384)
              at sun.awt.windows.WToolkit.targetDisposedPeer(WToolkit.java:681)
              at sun.awt.windows.WMenuItemPeer.disposeImpl(WMenuItemPeer.java:33)
              at sun.awt.windows.WObjectPeer.dispose(WObjectPeer.java:53)
              at java.awt.MenuComponent.removeNotify(MenuComponent.java:254)
              - locked <0x02a926c8> (a java.awt.Component$AWTTreeLock)
              at java.awt.Menu.removeNotify(Menu.java:171)
              - locked <0x02a926c8> (a java.awt.Component$AWTTreeLock)
              at java.awt.MenuBar.removeNotify(MenuBar.java:136)
              - locked <0x02a926c8> (a java.awt.Component$AWTTreeLock)
              at java.awt.Frame.removeNotify(Frame.java:876)
              - locked <0x02a926c8> (a java.awt.Component$AWTTreeLock)
              at java.awt.Window$1DisposeAction.run(Window.java:984)
              at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:595)
              at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
              at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
      "AWT-Windows":
              at java.util.Collections$SynchronizedMap.isEmpty(Collections.java:1966)
              - waiting to lock <0x02ee5c40> (a java.util.Collections$SynchronizedMap)
              at sun.awt.AWTAutoShutdown.isReadyToShutdown(AWTAutoShutdown.java:207)
              at sun.awt.AWTAutoShutdown.setToolkitBusy(AWTAutoShutdown.java:236)
              - locked <0x02ee1760> (a java.lang.Object)
              - locked <0x02ef16f8> (a java.lang.Object)
              at sun.awt.AWTAutoShutdown.notifyToolkitThreadFree(AWTAutoShutdown.java:132)
              at sun.awt.windows.WToolkit.eventLoop(Native Method)
              at sun.awt.windows.WToolkit.run(WToolkit.java:290)
              at java.lang.Thread.run(Thread.java:619)

      Found 1 deadlock.
      One of the VM tests is affected by this bug:
      jit/common/misctests/fpustack

            son Oleg Sukhodolsky (Inactive)
            art Artem Ananiev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: