Ticket #760 (closed defect: fixed)

Opened 8 years ago

Last modified 7 years ago

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 8 years ago 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 7 years ago 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 7 years ago 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.

Note: See TracTickets for help on using tickets.