On 16.11.24 07:42, Fred Damen wrote:
> There is a signal that you can send to the JVM that will
> give a backtrace of each thread. This may give information
> as to if the thread with the genericdialog got hung some how???

Hi Fred,

on Linux (and probably MacOs), if you start ImageJ from the command line, you can type
  kill -3 <PID>
where <PID> is the process ID of ImageJ.
This is best done in a second terminal window (not the one where you have started ImageJ). Alternatively, start ImageJ with a trailing '&', then you can issue the 'kill -3' in the same terminal window.

You can get the PID of ImageJ with
  ps -C ImageJ

I don't think that Windows has anything equivalent, but you could have a look here:
  https://access.redhat.com/solutions/19170

Anyhow, do you see the dialog in the list of Windows in ImageJ? Then there is some probability that it has width=height=0 or that it is outside the visible screen.

In this case: Create a text widndow before you start your plugin, select Macros>Enter Interactive mode... and type
  js
to enter JavaScript mode
Then start your plugin, and type
  w=WindowManager.getWindow("my dialog title");
with the dialog title as it appears in the Windows menu.
Then you can probe the properties of that dialog window, e.g.
  w.getWidth();

Otherwise:

If everything in ImageJ is frozen (if clicking on "Window" does not show the menu), then it is likely that the EventQueue is stuck because of a deadlock.
If so, do you mix SWING and AWT in your user interface?
If you use SWING, you must make sure that everything that modifies the user interface (crating dialogs, adding/changeing components) must be done in the EventQueue, best with EventQueue.invokeLater.


Michael
________________________________________________________________
On 16.11.24 07:42, Fred Damen wrote:
Some of my plugins create dozens of images. After needing to see a
particular window and can not find it, I discovered they existed but had 0
width and 0 height. After several fixes were made in ImageJ's displaying
ImageWindow(s) they no longer showed as w0h0. Some time they show up with
incorrect imagecanvas width/height, but I figured out how to fix that.

I have had genericdialog(s) not display during development, although
infrequent and not reproducible; probably coding blunders.

There is a signal that you can send to the JVM that will give a backtrace
of each thread. This may give information as to if the thread with the
genericdialog got hung some how???

Fred

On Fri, November 15, 2024 9:08 pm, Kenneth Sloan wrote:
yes - displaying the dialog box with 0 width and 0 height would explain
the reported symptoms.

Any idea what causes it?

--
Kenneth Sloan
[email protected]
Vision is the art of seeing what is invisible to others.





On Nov 15, 2024, at 17:13, Fred Damen <[email protected]> wrote:

Greetings Kenneth,

I have experienced the same, but different, angst(s) in the past. I had
ImageWindow(s) that were displayed with zero width and zero height, and,
I
created TextWindow(s) but never show(ed) them - but they stayed around
after the plugin exited; both hard to see / deal with using ImageJ GUI
menu commands. I wrote my FindWindow plugin to rectify these, and other,
issues. Its also helpful to work around the problems with the Window
menu.

See attached (remove .txt extension as we can not attach .java files)

Enjoy,

Fred

ps: On Linux you can see all the windows that exist. My naive
recollection
Windows / MacOS only shows the Application instances that exist, but you
may find a way to find all windows? I would assume that there is some
way
to ask the JVM what windows it thinks exists?


On Fri, November 15, 2024 12:00 am, Kenneth R Sloan wrote:
yes - it works on my machine, too.  but, it fails (silently waiting,
with
no dialog displayed) on three other machines.  it had been workibg on
those
machines, too, for months.

i was hoping this had happened to someone else.  i fully expect it to
work

i ââ,¬Å"fixedââ,¬Â it by commenting out this code, removing the user
option to
change these patameters, and all is well - even thought there is
another
NonBlockingGenericDialog further along in the cide.  I canââ,¬â"¢t
remove that
one!

Behavior that cant be replicated is a bitch to debug!  I was hoping
that
someone else had run into this and knew what it was.

The only thing common to the failing machines seems to be the local
network.  And it is 1000 miles from me.

even on the failing machines, it was working and then failed only 5
minutes
later, with no updates in between, as far as we know.   Iââ,¬â"¢m not
sure if
they  restarted FIJI in between success and failure.

Iââ,¬â"¢m baffled!

Thanks for confirming that it works somewhere other than my personal
machine.  as near as i can determine, showDialog() is called, but dies
nothing, and never returns, never displays anything, and does not throw
an
Exception.

-Kenneth Sloan


On Thu, Nov 14, 2024 at 22:33 Wayne Rasband <[email protected]
<mailto:[email protected]>> wrote:

Hi Kenneth,

I converted your test code to JavaScript,n fixed problems with missing
variable declarations and ran the script successfully on macOS, Linux
and
Windows, on my MacBook Air.nths

-wayne

  IJ.log("building dialog");
  gd = new NonBlockingGenericDialog("User Paraameters");
  IJ.log("created  gd");
  caseID = "noCaseID";
  gd.addStringField("Case ID:",caseID);
  IJ.log("added Case ID:  "+caseID);
  markerRoiRadius = 10;
  gd.addNumericField("Marker Radius(pixels):", markerRoiRadius,0);
  IJ.log("added Marker Radius");
  dialogX = 0;
  dialogY = 0;
  gd.setLocation(dialogX,dialogY);
  IJ.log("setLocation "+dialogX+"   "+dialogY);
  gd.showDialog();
  IJ.log("gd.wasCanceled()  =" + gd.wasCanceled());
  IJ.log("getting  caseID");
  caseID = gd.getNextString();
  IJ.log("caseID = "+caseID);
  markerRoiRadius = gd.getNextNumber();
  IJ.log("markerRoiRadius = "+markerRoiRadius);


On Nov 14, 2024, at 3:43 PM, Kenneth Sloan <[email protected]
<mailto:[email protected]>>
wrote:

I have a plugin which has been working for 6 months.

Today, I got a report that it failed, on both Windows and Mac
machines.

I asked for the input, and tried to replicate the problem.  Its works
just fine on my MacBook Pro.

All machines have been updated to the latest FIJI release.

I added some logging, so the relevant code looks like this:

      // get user-specified parameters
      IJ.log("building dialog");
      NonBlockingGenericDialog gdParms = new
NonBlockingGenericDialog("User Paraameters");
      IJ.log("created  gdParms");
      String caseID = "noCaseID";
      gdParms.addStringField("Case ID:",caseID);
      IJ.log("added Case ID:  "+caseID);
      gdParms.addNumericField(ââ,¬Å"Marker Radius(pixels):ââ,¬Â,
     markerRoiRadius,0);
      IJ.log("added Marker Radius");
      gdParms.setLocation(dialogX,dialogY);
      IJ.log("setLocation "+dialogX+"   "+dialogY);
      gdParms.showDialog();
      IJ.log("gdParms.wasCanceled()  =" + gdParms.wasCanceled());
      if(gdParms.wasCanceled()) return;
      IJ.log("getting  caseID");
      caseID = gdParms.getNextString();
      IJ.log("caseID = "+caseID);
      markerRoiRadius = (int)gdParms.getNextNumber();
      IJ.log("markerRoiRadius = "+markerRoiRadius);

The Log window ends with the line:

      SetLocation  0     0
Soââ,¬Â¦ the statement:

      gdParms.showDialog();

Appears to have been executed, but nothing appears on the screen, and
the program stalls.

There is no relevant output in the Console window.

We have rebooted, updated FIJI, all to no avail.

It fails on 3 machines (2 Windows and one Mac) in a research lab in a
medical center, but works perfectly on my MacBook Pro, at home.

The initial report claims that they were using the plugin on a series
of
cases.
It worked on a bunch of cases, and then failed on the next (and has
failed at their location every time since).  Ss soââ,¬Â¦no FIJI
update or
OS
update between the last success and the first failure.

Iââ,¬â"¢m baffled.   Any ideas?

Finally, the user reports that when the plugin stalls, all other FIJI
functions work properly.  Itââ,¬â"¢s as if ââ,¬Å"showDialog()ââ,¬Â
has either
terminated
the plugin (without anything in the Log or Console window), or is
waiting
for an input (but has not actually displayed the dialog box).  I asked
them
to hit ESC, which had no effect.
--
Kenneth Sloan
[email protected]
Vision is the art of seeing what is invisible to others.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
<FindWindow.java.txt>


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Reply via email to