NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug.

The Fiji project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Bug 1013 - Apparent deadlock freezes Fiji
Apparent deadlock freezes Fiji
Status: RESOLVED INVALID
Product: Fiji
Classification: Unclassified
Component: Other
unspecified
PC All
: P5 blocker
Assigned To: ImageJ Bugs Mailing List
Depends on:
Blocks:
 
Reported: 2015-03-01 02:52 CST by Ilan Tal
Modified: 2015-03-02 12:00 CST
2 users (show)

See Also:


Attachments
thread dump (22.54 KB, text/plain)
2015-03-02 05:36 CST, Ilan Tal

Description Ilan Tal 2015-03-01 02:52:30 CST
In 2 of my dialog boxes I have a button which calls Close All

IJ.runPlugIn("ij.plugin.Commands", "close-all");

I run ./ImageJ-linux64 in a terminal to see any possible error messages, but there are no errors. I also see the problem on a Mac, which is the first place it was reported.

The program I use to demonstrate the problem is Run from CD from the Pet-Ct package. Any dialog which calls the above runPlugIn will do just as well. Read BI studies, which needs a database also shows the problem.

To demonstrate the problem we need at least 2 cines running at a high frame rate. A frame rate of 1 will work, a frame rate of 10 will hang. What I do is bring up 2 series and run both of them in cine with a frame rate of 10.

Then I press my button. The first cine will close, but the second won't. The cine will freeze, as will everything else in Fiji. The only way to solve the problem is to force quit Fiji.

Since there are no error messages, it looks like a deadlock. There was a bug in ImageJ which I reported to Wayne Rasband and he fixed in the daily build, so you need to use the latest ImageJ to avoid the bug which Wayne fixed.

An interesting point is that Close All in the File menu works OK. Likewise ImageJ works OK even with the button. Only Fiji hangs.

I am guessing that there is a deadlock somewhere. Because of the high frame rate there are many events. The first cine gets closed and to continue some internal loop for the second cine, an event telling that the first cine has closed needs to arrive. That event is apparently lost so the system patiently waits forever.
This is obviously a guess on my part. My Netbeans uses ImageJ for debugging and ImageJ works no matter what I do. I don't have the full source code for Fiji on my machine so it is difficult to pick up where the deadlock might be. This is without getting into the fact that I don't really know what is going on inside the system code. In short, it is over my head.

I will be happy to help if I can do anything to help with this bug.

Ilan
Comment 1 Wayne Rasband 2015-03-01 07:16:23 CST
Try running Fiji from the command line and pressing control+"\" when it hangs. This will generate a full thread dump that may contain information helpful for diagnosing the cause of the thread deadlock.

Also, try modifying your plugin so that it uses IJ.doCommand("Close All"), which runs "Close All" in s separate thread.
Comment 2 Curtis Rueden 2015-03-01 22:30:32 CST
As Wayne suggests, a full stack trace would be helpful to diagnose any deadlocks.

For details, see:
http://imagej.net/Debugging#Debugging_JVM_hangs
Comment 3 Ilan Tal 2015-03-02 05:36:08 CST
Created attachment 238
thread dump
Comment 4 Ilan Tal 2015-03-02 05:58:56 CST
I had some difficulty getting the thread trace. Apparently my keyboard layout is somewhat different. Ctrl+"\" didn't do anything. I tried every key on the keyboard until Crtl+4 did the job.

Wayne's idea of doCommand was very promising since it does the command on a different thread. I commented out the original and changed it to:

private void jButClearActionPerformed(java.awt.event.ActionEvent evt) {                                          
//		IJ.runPlugIn("ij.plugin.Commands", "close-all");
		IJ.doCommand("Close All");
}                                         

This version doesn't hang and I will give it to Jerry so he can continue to work. If there is interest to find out why the first command fails, I will be glad to try and help. It is much less urgent with the work around.

Thanks,
Ilan
Comment 5 Curtis Rueden 2015-03-02 12:00:53 CST
From the thread dump, it looks like you have "Enable ImageJ2 data structures" turned on in Edit > Options > ImageJ2. Please turn off this option unless you know you need it.

If you still experience a deadlock with that option disabled, feel free to reopen this issue.