NOTICE! This is a static HTML version of a legacy ImageJ Trac ticket.

The ImageJ project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Ticket #760 (closed defect: fixed)

Opened 2011-09-16T13:13:01-05:00

Last modified 2011-10-24T14:47:41-05:00

IJ1 Plugins that hatch threads are problematic

Reported by: bdezonia Owned by: bdezonia
Priority: critical Milestone: imagej2-b1-initial
Component: Legacy Compatibility Version:
Severity: critical Keywords:
Cc: Blocked By:
Blocking:

Description

Currently LegacyPlugin relies on the assumption that the plugin that gets called does not return with worker threads still running. If a plugin does this then LegacyPlugin might not capture all it's outputs or close all windows that should close.

Unfortunately the IJ1 plugin named Compile And Run does just this. As designed many plugins will cause the legacy layer problems.

Change History

comment:1 Changed 2011-09-16T13:31:59-05:00 by bdezonia

Here is a plugin run() method that causes problems:

public void run(String arg) {

try {

Thread.sleep(6000);

} catch (Exception e) {
}
ImagePlus imp = IJ.createImage("Untitled", "8-bit Ramp", 400, 400, 1);
imp.show();

}

The first time you run it no output is shown. The subsequent runs immediately show an image (likely the last one that was created in the previous run).

comment:2 Changed 2011-10-24T10:11:37-05:00 by bdezonia

See also #688

In general our solution cannot handle multithreaded plugins. A better approach: more nearly mirror IJ1. Make LegacyPlugin have NO outputs. Have application own a thread running some new harmonizer that is a combination of LegacyImageMap and Harmonizer. ImagePlusMethods could request harmonization upon detection of draw/show kinds of calls. This new harmonizer would always be translating back and forth as needed. LegacyPlugin::run() could request harmonizations before calling the IJ1 plugin. Thus multithreaded plugins always display data as expected (unless they are highly interactive).

This needs further discussion before we make any decisions.

comment:3 Changed 2011-10-24T14:47:41-05:00 by bdezonia

  • Status changed from new to closed
  • Resolution set to fixed

Fixed by b50bfa536f5793433a7a8e7e3763eb1adb1a7bc0, a7109f7ebaf8390aa4faa6992826448b1a7abea0, and 2aefe82e261569be2236549eb47544bb15e2e4ae. See ticket #688 for discussion and resolution.