Reputation: 2251
I have a test, that opens a JFrame when failing & showing me some debug info. It usually works just fine, but now I'm suddenly getting a weird deadlock.
When I click dump threads on IntelliJ I get this:
```
java.lang.Thread.State: RUNNABLE
at java.lang.Thread.holdsLock(Native Method)
at java.awt.Component.checkTreeLock(Component.java:1202)
at java.awt.Component.getSiblingIndexAbove(Component.java:9858)
at java.awt.Component.getHWPeerAboveMe(Component.java:9890)
at java.awt.Component.updateZOrder(Component.java:10154)
at java.awt.Component.addNotify(Component.java:6953)
- locked <0x00000006ce23ddd0> (a java.awt.Component$AWTTreeLock)
at java.awt.Container.addNotify(Container.java:2762)
- locked <0x00000006ce23ddd0> (a java.awt.Component$AWTTreeLock)
at javax.swing.JComponent.addNotify(JComponent.java:4740)
at java.awt.Container.addNotify(Container.java:2773)
- locked <0x00000006ce23ddd0> (a java.awt.Component$AWTTreeLock)
at javax.swing.JComponent.addNotify(JComponent.java:4740)
at java.awt.Container.addNotify(Container.java:2773)
- locked <0x00000006ce23ddd0> (a java.awt.Component$AWTTreeLock)
at javax.swing.JComponent.addNotify(JComponent.java:4740)
at java.awt.Container.addNotify(Container.java:2773)
- locked <0x00000006ce23ddd0> (a java.awt.Component$AWTTreeLock)
at javax.swing.JComponent.addNotify(JComponent.java:4740)
at java.awt.Container.addNotify(Container.java:2773)
- locked <0x00000006ce23ddd0> (a java.awt.Component$AWTTreeLock)
at javax.swing.JComponent.addNotify(JComponent.java:4740)
at java.awt.Container.addNotify(Container.java:2773)
- locked <0x00000006ce23ddd0> (a java.awt.Component$AWTTreeLock)
at javax.swing.JComponent.addNotify(JComponent.java:4740)
at java.awt.Container.addNotify(Container.java:2773)
- locked <0x00000006ce23ddd0> (a java.awt.Component$AWTTreeLock)
at javax.swing.JComponent.addNotify(JComponent.java:4740)
at java.awt.Container.addNotify(Container.java:2773)
- locked <0x00000006ce23ddd0> (a java.awt.Component$AWTTreeLock)
at javax.swing.JComponent.addNotify(JComponent.java:4740)
at java.awt.Container.addNotify(Container.java:2773)
- locked <0x00000006ce23ddd0> (a java.awt.Component$AWTTreeLock)
at javax.swing.JComponent.addNotify(JComponent.java:4740)
at java.awt.Container.addNotify(Container.java:2773)
- locked <0x00000006ce23ddd0> (a java.awt.Component$AWTTreeLock)
at javax.swing.JComponent.addNotify(JComponent.java:4740)
at java.awt.Container.addNotify(Container.java:2773)
- locked <0x00000006ce23ddd0> (a java.awt.Component$AWTTreeLock)
at javax.swing.JComponent.addNotify(JComponent.java:4740)
at java.awt.Container.addNotify(Container.java:2773)
- locked <0x00000006ce23ddd0> (a java.awt.Component$AWTTreeLock)
at javax.swing.JComponent.addNotify(JComponent.java:4740)
at javax.swing.JRootPane.addNotify(JRootPane.java:757)
at java.awt.Container.addNotify(Container.java:2773)
- locked <0x00000006ce23ddd0> (a java.awt.Component$AWTTreeLock)
at java.awt.Window.addNotify(Window.java:770)
- locked <0x00000006ce23ddd0> (a java.awt.Component$AWTTreeLock)
at java.awt.Frame.addNotify(Frame.java:487)
- locked <0x00000006ce23ddd0> (a java.awt.Component$AWTTreeLock)
at java.awt.Window.pack(Window.java:807)
at mypackage.LogViewer.viewInFrame(LogViewer.java:380)
at mypackage.LogViewer.viewInFrame(LogViewer.java:380)
at mypackage.TestLogger.viewInFrame(TestLogger.java:280)
at mythingytotest.MyTestClass(MyTestClass.java:87)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:513)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:115)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:170)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda$166/945591847.execute(Unknown Source)
at org.junit.jupiter.engine.execution.ThrowableCollector.execute(ThrowableCollector.java:40)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:166)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:113)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:58)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:113)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$112/1597249648.execute(Unknown Source)
at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(HierarchicalTestExecutor.java:121)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$115/1694556038.accept(Unknown Source)
```
There are no other threads that have any of my code in them. Even if there were I cant see how it could cause deadlocks there.
The logviewer component is using just primitives & collections of primitives & vanilla swing components: JComboBox, JTextField, JPanel, JCheckBox
Upvotes: 3
Views: 188
Reputation: 2251
Ty for the pointless downvote.
Anyways, just in case some poor lost soul stumbles upon something similar in the future:
Threre was in fact no deadlock. This was caused by:
1) that logviewer component having assloads of events inside & it taking quite some time to open it
2) an ubuntu glitch I have that made the jframe be completely invisible
Upvotes: 3