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 #1605 (closed defect: wontfix)

Opened 2012-12-14T10:06:16-06:00

Last modified 2014-08-19T11:12:14-05:00

Exception thrown when many images opened simultaneously

Reported by: bdezonia Owned by: bdezonia
Priority: major Milestone: imagej2-b8-analysis
Component: Legacy Compatibility Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking: #1457


Start IJ2. Hold down Shift Command B so that many Blobs images get opened very quickly. See that an exception is thrown in Eclipse' console. Code inspection shows this to be a weird issue where someone has likely called ImageProcessor::resetThreshold() while another thread is in ByteProcessor::setMinAndMax(). I suspect that updateImagePlusesFromDIsplays() is updating an ImagePlus that is also currently being updated by a Harmonizer in another LegacyCommand. If we locked Displays or ImagePluses as needed this issue would not arise.

Uncaught exception in thread Thread[IJ1 legacy thread,6,IJ1 legacy group]

at ij.process.ByteProcessor.setMinAndMax(
at ij.ImagePlus.setDisplayRange(
at imagej.legacy.translate.ColorTableHarmonizer.assignImagePlusMinMax(
at imagej.legacy.translate.ColorTableHarmonizer.updateLegacyImage(
at imagej.legacy.translate.Harmonizer.updateLegacyImage(
at imagej.legacy.plugin.LegacyCommand$LegacyCommandThread.updateImagePlusesFromDisplays(
at imagej.legacy.plugin.LegacyCommand$

Change History

comment:1 Changed 2012-12-14T10:06:34-06:00 by bdezonia

  • Blocking 1563 added

comment:2 Changed 2012-12-14T10:11:28-06:00 by bdezonia

Note this issue has arisen in code that relied on the original LegacyOutputTracker ThreadLocal approach. If you use code from the legacy-tracker branch (relying on synchronized methods and tracking things by ThreadGroup) I think the problem manifests itself in a different way (due to timing). Again it is that everyone is trying to update all the ImagePluses themselves. We need to be smarter about how we make sure ImagePluses contain the latest data of a Display when a legacy plugin is launched avoiding threading issues and inefficiencies.

comment:3 Changed 2012-12-14T12:46:18-06:00 by bdezonia

Note this issue is different from #1606

comment:4 Changed 2013-01-07T14:41:23-06:00 by bdezonia

Merged the legacy-output-tracker code some time ago. So the above exception is likely no longer happening. But the underlying issues still exist.

comment:5 Changed 2013-01-15T12:34:04-06:00 by bdezonia

The current exception is

[ERROR] java.lang.NullPointerException

at imagej.ui.viewer.image.AbstractImageDisplayViewer.onEvent(
at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at imagej.event.DefaultEventService$ProxySubscriber.onEvent(
at imagej.event.DefaultEventService$ProxySubscriber.onEvent(
at org.bushe.swing.event.ThreadSafeEventService.publish(
at imagej.event.DefaultEventBus.access$1(
at imagej.event.DefaultEventBus$
at imagej.thread.DefaultThreadService.invoke(
at imagej.event.DefaultEventBus.publishNow(
at imagej.event.DefaultEventBus.publishNow(
at imagej.event.DefaultEventService.publish(
at imagej.ui.swing.viewer.image.JHotDrawImageCanvas.sync(
at imagej.ui.swing.viewer.image.JHotDrawImageCanvas.syncCanvas(
at imagej.ui.swing.viewer.image.JHotDrawImageCanvas.componentResized(
at java.awt.AWTEventMulticaster.componentResized(
at java.awt.Component.processComponentEvent(
at java.awt.Component.processEvent(
at java.awt.Container.processEvent(
at java.awt.Component.dispatchEventImpl(
at java.awt.Container.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.EventQueue.dispatchEventImpl(
at java.awt.EventQueue.access$400(
at java.awt.EventQueue$
at java.awt.EventQueue$
at Method)
at java.awt.EventQueue$
at java.awt.EventQueue$
at Method)
at java.awt.EventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForFilters(
at java.awt.EventDispatchThread.pumpEventsForFilter(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(

comment:6 Changed 2013-01-15T12:56:52-06:00 by bdezonia

Exception in previous comment dispatched with commit 3e54935fc52f44b92ba5e29da6a4e745c92e684a.

The first exception mentioned in the ticket description still happens and will do so until we address ticket #1192 (for reasons outlined above).

comment:7 Changed 2013-04-03T13:49:21-05:00 by bdezonia

  • Priority changed from major to minor

comment:8 Changed 2013-04-03T13:50:39-05:00 by bdezonia

  • Priority changed from minor to major

comment:9 Changed 2013-06-04T11:38:39-05:00 by bdezonia

  • Blocking 1457 added; 1563 removed
  • Milestone changed from imagej2-b7-ndim-data to imagej2-b8-analysis

comment:10 Changed 2014-08-19T11:12:14-05:00 by curtis

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

We are no longer supporting use of ImageJ 1.x commands from modern ImageJ2 UIs, so this issue might be moot now. If similar issues arise with pure-IJ2 workflows, we can file a new issue.