Ticket #1605 (closed defect: wontfix)

Opened 5 years ago

Last modified 3 years ago

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

Description

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]
java.lang.NullPointerException

at ij.process.ByteProcessor.setMinAndMax(ByteProcessor.java:455)
at ij.ImagePlus.setDisplayRange(ImagePlus.java:2144)
at imagej.legacy.translate.ColorTableHarmonizer.assignImagePlusMinMax(ColorTableHarmonizer.java:275)
at imagej.legacy.translate.ColorTableHarmonizer.updateLegacyImage(ColorTableHarmonizer.java:129)
at imagej.legacy.translate.Harmonizer.updateLegacyImage(Harmonizer.java:139)
at imagej.legacy.plugin.LegacyCommand$LegacyCommandThread.updateImagePlusesFromDisplays(LegacyCommand.java:355)
at imagej.legacy.plugin.LegacyCommand$LegacyCommandThread.run(LegacyCommand.java:187)

Change History

comment:1 Changed 5 years ago by bdezonia

  • Blocking 1563 added

comment:2 Changed 5 years ago 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 5 years ago by bdezonia

Note this issue is different from #1606

comment:4 Changed 5 years ago 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 5 years ago by bdezonia

The current exception is

[ERROR] java.lang.NullPointerException

at imagej.ui.viewer.image.AbstractImageDisplayViewer.onEvent(AbstractImageDisplayViewer.java:293)
at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at imagej.event.DefaultEventService$ProxySubscriber.onEvent(DefaultEventService.java:226)
at imagej.event.DefaultEventService$ProxySubscriber.onEvent(DefaultEventService.java:1)
at org.bushe.swing.event.ThreadSafeEventService.publish(ThreadSafeEventService.java:971)
at imagej.event.DefaultEventBus.access$1(DefaultEventBus.java:1)
at imagej.event.DefaultEventBus$1.run(DefaultEventBus.java:201)
at imagej.thread.DefaultThreadService.invoke(DefaultThreadService.java:86)
at imagej.event.DefaultEventBus.publishNow(DefaultEventBus.java:195)
at imagej.event.DefaultEventBus.publishNow(DefaultEventBus.java:87)
at imagej.event.DefaultEventService.publish(DefaultEventService.java:79)
at imagej.data.display.DefaultImageCanvas.publishPanZoomEvent(DefaultImageCanvas.java:417)
at imagej.data.display.DefaultImageCanvas.setPanCenter(DefaultImageCanvas.java:249)
at imagej.data.display.DefaultImageCanvas.setZoomAndCenter(DefaultImageCanvas.java:317)
at imagej.ui.swing.viewer.image.JHotDrawImageCanvas.sync(JHotDrawImageCanvas.java:515)
at imagej.ui.swing.viewer.image.JHotDrawImageCanvas.syncCanvas(JHotDrawImageCanvas.java:456)
at imagej.ui.swing.viewer.image.JHotDrawImageCanvas.componentResized(JHotDrawImageCanvas.java:296)
at java.awt.AWTEventMulticaster.componentResized(AWTEventMulticaster.java:143)
at java.awt.Component.processComponentEvent(Component.java:6208)
at java.awt.Component.processEvent(Component.java:6162)
at java.awt.Container.processEvent(Container.java:2083)
at java.awt.Component.dispatchEventImpl(Component.java:4744)
at java.awt.Container.dispatchEventImpl(Container.java:2141)
at java.awt.Component.dispatchEvent(Component.java:4572)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:704)
at java.awt.EventQueue.access$400(EventQueue.java:82)
at java.awt.EventQueue$2.run(EventQueue.java:663)
at java.awt.EventQueue$2.run(EventQueue.java:661)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:677)
at java.awt.EventQueue$3.run(EventQueue.java:675)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:674)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

comment:6 Changed 5 years ago 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 5 years ago by bdezonia

  • Priority changed from major to minor

comment:8 Changed 5 years ago by bdezonia

  • Priority changed from minor to major

comment:9 Changed 4 years ago by bdezonia

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

comment:10 Changed 3 years ago 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.

Note: See TracTickets for help on using tickets.