I am observing a deadlock inside of AWT clipboard infrastructure when running NetBeans tests:
Found one Java-level deadlock:
=============================
"Test Watch Dog: testNodeAddingAndRemoving":
waiting to lock monitor 0x00007f65f009fb68 (object 0x00000000fd2f5698, a java.awt.Component$AWTTreeLock),
which is held by "AWT-EventQueue-0"
"AWT-EventQueue-0":
waiting for ownable synchronizer 0x00000000fd334ed0, (a java.util.concurrent.locks.ReentrantLock$NonfairSync),
which is held by "AWT-XAWT"
"AWT-XAWT":
waiting to lock monitor 0x00007f65e8003750 (object 0x00000000fd35cc68, a java.awt.datatransfer.SystemFlavorMap),
which is held by "System clipboard synchronizer"
"System clipboard synchronizer":
waiting for ownable synchronizer 0x00000000fd334ed0, (a java.util.concurrent.locks.ReentrantLock$NonfairSync),
which is held by "AWT-XAWT"
Java stack information for the threads listed above:
===================================================
"Test Watch Dog: testNodeAddingAndRemoving":
at java.awt.Component.setFont(Component.java:1799)
- waiting to lock <0x00000000fd2f5698> (a java.awt.Component$AWTTreeLock)
at java.awt.Container.setFont(Container.java:1552)
at javax.swing.JComponent.setFont(JComponent.java:2723)
at javax.swing.LookAndFeel.installColorsAndFont(LookAndFeel.java:191)
at javax.swing.plaf.basic.BasicViewportUI.installDefaults(BasicViewportUI.java:47)
at javax.swing.plaf.basic.BasicViewportUI.installUI(BasicViewportUI.java:38)
at javax.swing.JComponent.setUI(JComponent.java:662)
at javax.swing.JViewport.setUI(JViewport.java:285)
at javax.swing.JViewport.updateUI(JViewport.java:295)
at javax.swing.JViewport.<init>(JViewport.java:255)
at javax.swing.JScrollPane.createViewport(JScrollPane.java:905)
at javax.swing.JScrollPane.<init>(JScrollPane.java:280)
at javax.swing.JScrollPane.<init>(JScrollPane.java:333)
at org.openide.explorer.view.ListView.<init>(ListView.java:219)
at org.openide.explorer.view.ListViewTest$PListView.<init>(ListViewTest.java:299)
at org.openide.explorer.view.ListViewTest$PListView.<init>(ListViewTest.java:299)
at org.openide.explorer.view.ListViewTest.testNodeAddingAndRemoving(ListViewTest.java:257)
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:99)
at org.netbeans.junit.NbTestCase$2.doSomething(NbTestCase.java:405)
at org.netbeans.junit.NbTestCase$1Guard.run(NbTestCase.java:331)
at java.lang.Thread.run(Thread.java:662)
"AWT-EventQueue-0":
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000000fd334ed0> (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.XInputMethod.createXICNative(Native Method)
at sun.awt.X11.XInputMethod.createXIC(XInputMethod.java:53)
at sun.awt.X11InputMethod.activate(X11InputMethod.java:315)
- locked <0x00000000fd35a510> (a sun.awt.X11.XInputMethod)
at sun.awt.im.InputContext.activateInputMethod(InputContext.java:376)
at sun.awt.im.InputContext.focusGained(InputContext.java:320)
- locked <0x00000000fd35a488> (a sun.awt.im.InputMethodContext)
- locked <0x00000000fd2f5698> (a java.awt.Component$AWTTreeLock)
at sun.awt.im.InputContext.dispatchEvent(InputContext.java:227)
at sun.awt.im.InputMethodContext.dispatchEvent(InputMethodContext.java:180)
at java.awt.Component.dispatchEventImpl(Component.java:4587)
at java.awt.Container.dispatchEventImpl(Container.java:2097)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1836)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:901)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:513)
at java.awt.Component.dispatchEventImpl(Component.java:4525)
at java.awt.Container.dispatchEventImpl(Container.java:2097)
at java.awt.Component.dispatchEvent(Component.java:4481)
at sun.awt.X11.XWindow$1.run(XWindow.java:380)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:646)
at java.awt.EventQueue.access$000(EventQueue.java:84)
at java.awt.EventQueue$1.run(EventQueue.java:607)
at java.awt.EventQueue$1.run(EventQueue.java:605)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:616)
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-XAWT":
at java.awt.datatransfer.SystemFlavorMap.getFlavorsForNative(SystemFlavorMap.java:792)
- waiting to lock <0x00000000fd35cc68> (a java.awt.datatransfer.SystemFlavorMap)
at sun.awt.datatransfer.DataTransferer.getFlavorsForFormatsAsSet(DataTransferer.java:846)
at sun.awt.datatransfer.SunClipboard.formatArrayAsDataFlavorSet(SunClipboard.java:333)
at sun.awt.datatransfer.SunClipboard.checkChange(SunClipboard.java:408)
at sun.awt.X11.XClipboard.checkChange(XClipboard.java:104)
at sun.awt.X11.XSelection.checkChange(XSelection.java:754)
at sun.awt.X11.XSelection.access$200(XSelection.java:30)
at sun.awt.X11.XSelection$SelectionEventHandler.dispatchEvent(XSelection.java:764)
at sun.awt.X11.XToolkit.dispatchEvent(XToolkit.java:527)
at sun.awt.X11.XToolkit.run(XToolkit.java:619)
at sun.awt.X11.XToolkit.run(XToolkit.java:543)
at java.lang.Thread.run(Thread.java:662)
"System clipboard synchronizer":
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000000fd334ed0> (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.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.XDataTransferer.getFormatForNativeAsLong(XDataTransferer.java:107)
at sun.awt.datatransfer.DataTransferer.registerTextFlavorProperties(DataTransferer.java:560)
at java.awt.datatransfer.SystemFlavorMap.parseAndStoreReader(SystemFlavorMap.java:378)
at java.awt.datatransfer.SystemFlavorMap.initSystemFlavorMap(SystemFlavorMap.java:251)
at java.awt.datatransfer.SystemFlavorMap.getNativeToFlavor(SystemFlavorMap.java:115)
at java.awt.datatransfer.SystemFlavorMap.nativeToFlavorLookup(SystemFlavorMap.java:521)
at java.awt.datatransfer.SystemFlavorMap.getFlavorsForNative(SystemFlavorMap.java:821)
- locked <0x00000000fd35cc68> (a java.awt.datatransfer.SystemFlavorMap)
at sun.awt.datatransfer.DataTransferer.getFlavorsForFormats(DataTransferer.java:770)
at sun.awt.datatransfer.ClipboardTransferable.<init>(ClipboardTransferable.java:72)
at sun.awt.X11.XClipboard.getContents(XClipboard.java:84)
- locked <0x00000000fd333b30> (a sun.awt.X11.XClipboard)
at org.netbeans.NbClipboard.run(NbClipboard.java:315)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1452)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2032)
Found 1 deadlock.