imagej / imagej-ui-swing

ImageJ UI for Java Swing.
BSD 2-Clause "Simplified" License
10 stars 20 forks source link

EDT deadlock when calling ImageJUpdater? #86

Closed frauzufall closed 3 years ago

frauzufall commented 4 years ago

Fiji freezes when calling the ImageJ updater on my Linux machine.

Context context = new Context();
CommandService commandService = context.service(CommandService.class);
commandService.run(ImageJUpdater.class, true);

Here is the stack trace:

"SciJava-4cc451f2-Thread-0" #15 prio=5 os_prio=0 tid=0x00007f34f4783800 nid=0x74dd waiting on condition [0x00007f34b147a000]
   java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x000000071bb820a0> (a java.util.concurrent.FutureTask)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
    at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:429)
    at java.util.concurrent.FutureTask.get(FutureTask.java:191)
    at org.GNOME.Accessibility.AtkUtil.invokeInSwing(AtkUtil.java:68)
    at org.GNOME.Accessibility.AtkObject.hashCode(AtkObject.java:234)
    at org.GNOME.Accessibility.AtkWrapper.emitSignal(Native Method)
    at org.GNOME.Accessibility.AtkWrapper$5.propertyChange(AtkWrapper.java:545)
    at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
    at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
    at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
    at javax.accessibility.AccessibleContext.firePropertyChange(AccessibleContext.java:768)
    at javax.swing.JScrollPane$AccessibleJScrollPane.stateChanged(JScrollPane.java:1506)
    at javax.swing.JViewport.fireStateChanged(JViewport.java:1369)
    at javax.swing.JViewport.setViewSize(JViewport.java:1021)
    at javax.swing.ViewportLayout.layoutContainer(ViewportLayout.java:201)
    at java.awt.Container.layout(Container.java:1513)
    at java.awt.Container.doLayout(Container.java:1502)
    at java.awt.Container.validateTree(Container.java:1698)
    at java.awt.Container.validateTree(Container.java:1707)
    at java.awt.Container.validateTree(Container.java:1707)
    at java.awt.Container.validateTree(Container.java:1707)
    at java.awt.Container.validateTree(Container.java:1707)
    at java.awt.Container.validateTree(Container.java:1707)
    at java.awt.Container.validate(Container.java:1633)
    - locked <0x00000005cde000a8> (a java.awt.Component$AWTTreeLock)
    at net.imagej.ui.swing.updater.ProgressDialog.addItem(ProgressDialog.java:207)
    at net.imagej.updater.util.AbstractProgressable.addItem(AbstractProgressable.java:75)
    at net.imagej.updater.XMLFileDownloader.start(XMLFileDownloader.java:84)
    at net.imagej.updater.FilesCollection.reloadCollectionAndChecksum(FilesCollection.java:1146)
    at net.imagej.ui.swing.updater.ImageJUpdater.run(ImageJUpdater.java:145)
    at org.scijava.command.CommandModule.run(CommandModule.java:199)
    at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
    at org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:238)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
frauzufall commented 3 years ago

This is happening with OpenJDK 1.8.0_212, but not with older versions present on my machine.

Something similar is happening with the same JDK when launching commands like this:

ImageJ ij = new ImageJ();
ij.launch();
ij.command().run(SwingColorWidgetDemo.class, true);

.. resulting in an unresponsive application and this stacktrace:

"SciJava-7b94089b-Thread-0" #13 prio=5 os_prio=0 tid=0x00007fafc8eba000 nid=0xf8d5 waiting on condition [0x00007fafb0104000]
   java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x0000000720d7b458> (a java.util.concurrent.FutureTask)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
    at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:429)
    at java.util.concurrent.FutureTask.get(FutureTask.java:191)
    at org.GNOME.Accessibility.AtkUtil.invokeInSwing(AtkUtil.java:68)
    at org.GNOME.Accessibility.AtkObject.hashCode(AtkObject.java:234)
    at org.GNOME.Accessibility.AtkWrapper.emitSignal(Native Method)
    at org.GNOME.Accessibility.AtkWrapper$5.propertyChange(AtkWrapper.java:545)
    at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
    at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
    at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
    at javax.accessibility.AccessibleContext.firePropertyChange(AccessibleContext.java:768)
    at javax.swing.JScrollPane$AccessibleJScrollPane.stateChanged(JScrollPane.java:1506)
    at javax.swing.JViewport.fireStateChanged(JViewport.java:1369)
    at javax.swing.JViewport.reshape(JViewport.java:839)
    at java.awt.Component.setBounds(Component.java:2261)
    at java.awt.Component.setBounds(Component.java:2405)
    at javax.swing.ScrollPaneLayout.layoutContainer(ScrollPaneLayout.java:890)
    at java.awt.Container.layout(Container.java:1513)
    at java.awt.Container.doLayout(Container.java:1502)
    at java.awt.Container.validateTree(Container.java:1698)
    at java.awt.Container.validateTree(Container.java:1707)
    at java.awt.Container.validateTree(Container.java:1707)
    at java.awt.Container.validateTree(Container.java:1707)
    at java.awt.Container.validateTree(Container.java:1707)
    at java.awt.Container.validateTree(Container.java:1707)
    at java.awt.Container.validate(Container.java:1633)
    - locked <0x00000005cde005a8> (a java.awt.Component$AWTTreeLock)
    at java.awt.Container.validateUnconditionally(Container.java:1670)
    - locked <0x00000005cde005a8> (a java.awt.Component$AWTTreeLock)
    at java.awt.Window.pack(Window.java:818)
    at org.scijava.ui.swing.SwingDialog.show(SwingDialog.java:259)
    at org.scijava.ui.swing.widget.SwingInputHarvester.harvestInputs(SwingInputHarvester.java:86)
    at org.scijava.widget.InputHarvester.harvest(InputHarvester.java:70)
    at org.scijava.ui.AbstractInputHarvesterPlugin.process(AbstractInputHarvesterPlugin.java:74)
    at org.scijava.module.ModuleRunner.preProcess(ModuleRunner.java:102)
    at org.scijava.module.ModuleRunner.run(ModuleRunner.java:154)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:124)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:63)
    at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:225)
    at org.scijava.thread.DefaultThreadService$$Lambda$102/142103421.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Pinging @hinerm - we talked about this in the past during standup. Would be great to verify if more people have this issue with newer Java versions.

ctrueden commented 3 years ago

@elevans Do you also see this problem on your Ubuntu 20.04 box?

@frauzufall Could you please test with JBRSDK8 and JBRSDK11? We are on the cusp of updating the Fiji bundles to package one of those (still deciding which). It would be awesome if one of those resolved this issue as well.

frauzufall commented 3 years ago

@ctrueden welcome back :) just to clarify, the Java version shipped with Fiji works fine in both cases. Will test the other versions your mentioned.

frauzufall commented 3 years ago

Yes, both JBRSDK8 and JBRSDK11 don't have these issues. I will therefore close this one, because it does not affect the currently shipped SDK and also not the one we will use next.