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 #1337 (closed defect: fixed)

Opened 2012-07-17T12:44:37-05:00

Last modified 2012-07-31T15:27:01-05:00

Stack To Images can hang IJ2

Reported by: bdezonia Owned by: bdezonia
Priority: critical Milestone: imagej2-b4-plugins
Component: Core Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking: #1331, #1345

Description (last modified by bdezonia)

open Bat Cochlea Renderings
Image > Stacks > Tools > Make Substack
--range: 1-10
Image > Stacks > Stack to Images

On my system running from within eclipse (so low memory issue here?) the system will hang up after displaying about 8 slices. Note also that original substack image is deleted from screen already (so do we have a race condition here?). Windows cannot be closed, menu can't be accessed, and double clicking on status bar has no effect. Cannot terminate except via Force Quit.

Change History

comment:1 Changed 2012-07-17T13:13:59-05:00 by bdezonia

  • Description modified

comment:2 Changed 2012-07-17T13:14:31-05:00 by bdezonia

  • Summary changed from IJ2 can hang to Stack To Images can hang IJ2

comment:3 Changed 2012-07-17T13:40:34-05:00 by bdezonia

  • Priority changed from major to critical

comment:4 Changed 2012-07-17T14:09:22-05:00 by bdezonia

  • Blocking 1331 added

comment:5 Changed 2012-07-27T14:04:27-05:00 by bdezonia

  • Blocking 1345 added

comment:6 Changed 2012-07-27T14:11:07-05:00 by bdezonia

This appears to be an issue where IJ2 cannot display more than 9 windows. Open Organ of Corti and do Stack To Images. Hangs after 9 total displays open. This is true using beta 3 with 6 gig of allocated memory (so not a low memory condition).

comment:7 Changed 2012-07-27T15:12:07-05:00 by bdezonia

  • Owner changed from bdezonia to curtis
  • Status changed from new to assigned

One would think there is a magic constant 10 in the EventBus/Service code but I have yet to find it.

I used Eclipse's debugger to inspect all the running threads. All but two threads are waiting. The other two are both in the EventBus code. It looks like a deadlock situation (the debugger suspends right after a synchronized(lock) statement). One thread is trying to publish a new DisplayCreatedEvent. The other thread is trying to get subscribers while publishing a PanZoomEvent.

Curtis, I know you've worked in this area before. Can you look at this?

comment:8 Changed 2012-07-27T15:23:05-05:00 by bdezonia

One thread:

"plugin thread" prio=6 tid=105a17800 nid=0x1269b6000 in Object.wait() [1269b4000]

java.lang.Thread.State: WAITING (on object monitor)

at java.lang.Object.wait(Native Method)

  • waiting on <7f42b0190> (a java.awt.EventQueue$1AWTInvocationLock) at java.lang.Object.wait(Object.java:485) at java.awt.EventQueue.invokeAndWait(EventQueue.java:1086)
  • locked <7f42b0190> (a java.awt.EventQueue$1AWTInvocationLock) at imagej.thread.DefaultThreadService.invoke(DefaultThreadService.java:104) at imagej.event.DefaultEventBus.publishNow(DefaultEventBus.java:191) at imagej.event.DefaultEventBus.publishNow(DefaultEventBus.java:110) at imagej.event.DefaultEventService.publish(DefaultEventService.java:89) at imagej.ext.display.DefaultDisplayService.createDisplay(DefaultDisplayService.java:220) at imagej.legacy.translate.GrayDisplayCreator.grayCase(GrayDisplayCreator.java:149) at imagej.legacy.translate.GrayDisplayCreator.createDisplay(GrayDisplayCreator.java:100) at imagej.legacy.translate.DefaultImageTranslator.createDisplay(DefaultImageTranslator.java:97) at imagej.legacy.translate.DefaultImageTranslator.createDisplay(DefaultImageTranslator.java:77) at imagej.legacy.LegacyImageMap.registerLegacyImage(LegacyImageMap.java:165) at imagej.legacy.LegacyService.legacyImageChanged(LegacyService.java:194) at imagej.legacy.patches.ImageWindowMethods.setVisible(ImageWindowMethods.java:63) at imagej.legacy.patches.ImageWindowMethods.show(ImageWindowMethods.java:72) at ij.gui.ImageWindow.show(ImageWindow.java) at ij.gui.ImageWindow.<init>(ImageWindow.java:135) at ij.gui.ImageWindow.<init>(ImageWindow.java:58) at ij.ImagePlus.show(ImagePlus.java:372) at ij.ImagePlus.show(ImagePlus.java:347) at ij.plugin.StackEditor.convertStackToImages(StackEditor.java:267) at ij.plugin.StackEditor.run(StackEditor.java:27) at ij.IJ.runPlugIn(IJ.java:158) at ij.IJ.runPlugIn(IJ.java:141) at imagej.legacy.plugin.LegacyPlugin$LegacyPluginThread.run(LegacyPlugin.java:192)

Locked ownable synchronizers:

  • None

Other thread:

"AWT-EventQueue-0" prio=6 tid=105954000 nid=0x11c86a000 waiting for monitor entry [11c867000]

java.lang.Thread.State: BLOCKED (on object monitor)

at org.bushe.swing.event.ThreadSafeEventService.subscribe(ThreadSafeEventService.java:644)

  • waiting to lock <7f4974698> (a java.lang.Object) at org.bushe.swing.event.ThreadSafeEventService.subscribe(ThreadSafeEventService.java:348) at imagej.event.DefaultEventService.subscribe(DefaultEventService.java:156) at imagej.event.DefaultEventService.subscribe(DefaultEventService.java:175) at imagej.event.DefaultEventService.subscribeRecursively(DefaultEventService.java:148) at imagej.event.DefaultEventService.subscribeRecursively(DefaultEventService.java:150) at imagej.event.DefaultEventService.subscribeRecursively(DefaultEventService.java:150) at imagej.event.DefaultEventService.subscribe(DefaultEventService.java:102) at imagej.ext.display.ui.AbstractDisplayViewer.view(AbstractDisplayViewer.java:75) at imagej.data.display.ui.AbstractImageDisplayViewer.view(AbstractImageDisplayViewer.java:92) at imagej.ui.swing.display.AbstractSwingImageDisplayViewer.view(AbstractSwingImageDisplayViewer.java:70) at imagej.ui.swing.sdi.display.SwingSdiImageDisplayViewer.view(SwingSdiImageDisplayViewer.java:63) at imagej.ui.DefaultUIService.onEvent(DefaultUIService.java:300) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 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:228) 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:197) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:682) at java.awt.EventQueue.access$000(EventQueue.java:85) at java.awt.EventQueue$1.run(EventQueue.java:643) at java.awt.EventQueue$1.run(EventQueue.java:641) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87) at java.awt.EventQueue.dispatchEvent(EventQueue.java:652) 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)

Locked ownable synchronizers:

  • None

comment:9 Changed 2012-07-31T09:35:39-05:00 by bdezonia

BTW changing all the publish() methods into publishLater() in DefaultDisplayService has no effect on this bug.

comment:10 Changed 2012-07-31T15:02:09-05:00 by curtis

  • Owner changed from curtis to bdezonia

I believe this is fixed in 3644f361. Please close if you agree.

comment:11 Changed 2012-07-31T15:27:01-05:00 by bdezonia

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