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( at java.awt.EventQueue.invokeAndWait(
  • locked <7f42b0190> (a java.awt.EventQueue$1AWTInvocationLock) at imagej.thread.DefaultThreadService.invoke( at imagej.event.DefaultEventBus.publishNow( at imagej.event.DefaultEventBus.publishNow( at imagej.event.DefaultEventService.publish( at imagej.ext.display.DefaultDisplayService.createDisplay( at imagej.legacy.translate.GrayDisplayCreator.grayCase( at imagej.legacy.translate.GrayDisplayCreator.createDisplay( at imagej.legacy.translate.DefaultImageTranslator.createDisplay( at imagej.legacy.translate.DefaultImageTranslator.createDisplay( at imagej.legacy.LegacyImageMap.registerLegacyImage( at imagej.legacy.LegacyService.legacyImageChanged( at imagej.legacy.patches.ImageWindowMethods.setVisible( at at at ij.gui.ImageWindow.<init>( at ij.gui.ImageWindow.<init>( at at at ij.plugin.StackEditor.convertStackToImages( at at ij.IJ.runPlugIn( at ij.IJ.runPlugIn( at imagej.legacy.plugin.LegacyPlugin$

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(

  • waiting to lock <7f4974698> (a java.lang.Object) at org.bushe.swing.event.ThreadSafeEventService.subscribe( at imagej.event.DefaultEventService.subscribe( at imagej.event.DefaultEventService.subscribe( at imagej.event.DefaultEventService.subscribeRecursively( at imagej.event.DefaultEventService.subscribeRecursively( at imagej.event.DefaultEventService.subscribeRecursively( at imagej.event.DefaultEventService.subscribe( at imagej.ext.display.ui.AbstractDisplayViewer.view( at at imagej.ui.swing.display.AbstractSwingImageDisplayViewer.view( at imagej.ui.swing.sdi.display.SwingSdiImageDisplayViewer.view( at imagej.ui.DefaultUIService.onEvent( at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( 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 java.awt.event.InvocationEvent.dispatch( at java.awt.EventQueue.dispatchEventImpl( at java.awt.EventQueue.access$000( at java.awt.EventQueue$ at java.awt.EventQueue$ at Method) at$1.doIntersectionPrivilege( 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( at

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