<div dir="ltr">Hi Lee,<div><br></div><div>I added the synchronized keyword yesterday to fix a bug. We can undo that change. I can work around the problem in another fashion if necessary.</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Thu, Sep 26, 2013 at 3:57 PM, Lee Kamentsky <span dir="ltr"><<a href="mailto:leek@broadinstitute.org" target="_blank">leek@broadinstitute.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi all, I'm getting a deadly embrace that happens when the AWT event queue thread tries to get a lock within DefaultDatasetView.getColor and when DefaultStatusService.showStatus on a worker thread tries to publish a synchronous request for status display after taking the DefaultDatasetView's lock in DefaultDatasetView.rebuild. It happens periodically, but it's timing-dependent, so not so reproducible.<div>
<br></div><div>The bug is somewhat debatable. Possible candidates: It's a little drastic for DefaultDatasetView.getColor to synchronize on the view itself. Maybe some proxy for the color system could have a synchronizing object. The other candidate is DefaultEventService.showStatus which could use EventService.publishLater - I don't think there's much need for status publishers to wait around for the status to show on the screen.</div>
<div><div><br></div><div>The two stack traces:</div><div><div>Thread [AWT-EventQueue-0] (Suspended)<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultDatasetView.getColor(ChannelCollection) line: 261<span style="white-space:pre-wrap"> <font color="#0000ff">Synchronized method on DefaultDatasetView</font></span></div>
<div><span style="white-space:pre-wrap"> </span>FgColorTool(AbstractColorTool).drawIcon() line: 175<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>FgColorTool(AbstractColorTool).onEvent(DisplayActivatedEvent) line: 184<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>Method.invoke(Object, Object...) line: 597<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultEventService$ProxySubscriber<E>.onEvent(E) line: 282<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultEventService$ProxySubscriber<E>.onEvent(Object) line: 1<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultEventBus(ThreadSafeEventService).publish(Object, String, Object, List, List, StackTraceElement[]) line: 971<span style="white-space:pre-wrap"> </span></div><div>
<span style="white-space:pre-wrap"> </span>DefaultEventBus.access$1(DefaultEventBus, Object, String, Object, List, List, StackTraceElement[]) line: 1<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultEventBus$1.run() line: 201<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultThreadService.invoke(Runnable) line: 91<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultEventBus.publishNow(Object, String, Object, List, List, StackTraceElement[]) line: 195<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultEventBus.publishNow(Object) line: 86<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultEventService.publish(E) line: 95<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultDisplayService.setActiveDisplay(Display<?>) line: 129<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultDisplayService.onEvent(WinActivatedEvent) line: 247<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>Method.invoke(Object, Object...) line: 597<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultEventService$ProxySubscriber<E>.onEvent(E) line: 282<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultEventService$ProxySubscriber<E>.onEvent(Object) line: 1<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultEventBus(ThreadSafeEventService).publish(Object, String, Object, List, List, StackTraceElement[]) line: 971<span style="white-space:pre-wrap"> </span></div><div>
<span style="white-space:pre-wrap"> </span>DefaultEventBus.access$1(DefaultEventBus, Object, String, Object, List, List, StackTraceElement[]) line: 1<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultEventBus$1.run() line: 201<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultThreadService.invoke(Runnable) line: 91<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultEventBus.publishNow(Object, String, Object, List, List, StackTraceElement[]) line: 195<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultEventBus.publishNow(Object) line: 86<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultEventService.publish(E) line: 95<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>AWTWindowEventDispatcher.windowActivated(WindowEvent) line: 94<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>SwingDisplayWindow(Window).processWindowEvent(WindowEvent) line: 1877<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>SwingDisplayWindow(JFrame).processWindowEvent(WindowEvent) line: 274<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>SwingDisplayWindow(Window).processEvent(AWTEvent) line: 1823<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>SwingDisplayWindow(Component).dispatchEventImpl(AWTEvent) line: 4630<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>SwingDisplayWindow(Container).dispatchEventImpl(AWTEvent) line: 2099<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>SwingDisplayWindow(Window).dispatchEventImpl(AWTEvent) line: 2478<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>SwingDisplayWindow(Component).dispatchEvent(AWTEvent) line: 4460<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultKeyboardFocusManager(KeyboardFocusManager).redispatchEvent(Component, AWTEvent) line: 1850<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultKeyboardFocusManager.typeAheadAssertions(Component, AWTEvent) line: 910<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultKeyboardFocusManager.dispatchEvent(AWTEvent) line: 409<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>SwingDisplayWindow(Component).dispatchEventImpl(AWTEvent) line: 4502<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>SwingDisplayWindow(Container).dispatchEventImpl(AWTEvent) line: 2099<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>SwingDisplayWindow(Window).dispatchEventImpl(AWTEvent) line: 2478<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>SwingDisplayWindow(Component).dispatchEvent(AWTEvent) line: 4460<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>EventQueue.dispatchEvent(AWTEvent) line: 599<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultKeyboardFocusManager$DefaultKeyboardFocusManagerSentEvent(SentEvent).dispatch() line: 55<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultKeyboardFocusManager$DefaultKeyboardFocusManagerSentEvent.dispatch() line: 183<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultKeyboardFocusManager.sendMessage(Component, AWTEvent) line: 210<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultKeyboardFocusManager.dispatchEvent(AWTEvent) line: 286<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>SwingDisplayWindow(Component).dispatchEventImpl(AWTEvent) line: 4502<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>SwingDisplayWindow(Container).dispatchEventImpl(AWTEvent) line: 2099<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>SwingDisplayWindow(Window).dispatchEventImpl(AWTEvent) line: 2478<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>SwingDisplayWindow(Component).dispatchEvent(AWTEvent) line: 4460<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>EventQueue.dispatchEvent(AWTEvent) line: 599<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>SequencedEvent.dispatch() line: 101<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>EventQueue.dispatchEvent(AWTEvent) line: 597<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>EventDispatchThread.pumpOneEventForFilters(int) line: 269<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>EventDispatchThread.pumpEventsForFilter(int, Conditional, EventFilter) line: 184<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>EventDispatchThread.pumpEventsForHierarchy(int, Conditional, Component) line: 174<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>EventDispatchThread.pumpEvents(int, Conditional) line: 169<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>EventDispatchThread.pumpEvents(Conditional) line: 161<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>EventDispatchThread.run() line: 122<span style="white-space:pre-wrap"> </span></div></div><div><br></div><div><div>Thread [SciJava-4b2922f6-Thread-27] (Suspended)<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>Object.wait(long) line: not available [native method]<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>EventQueue$1AWTInvocationLock(Object).wait() line: 485<span style="white-space:pre-wrap"> <font color="#0000ff">Waiting for AWT event thread to read invocation request.</font></span></div>
<div><span style="white-space:pre-wrap"> </span>EventQueue.invokeAndWait(Runnable) line: 993<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultThreadService.invoke(Runnable) line: 95<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultEventBus.publishNow(Object, String, Object, List, List, StackTraceElement[]) line: 195<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultEventBus.publishNow(Object) line: 86<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultEventService.publish(E) line: 95<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultStatusService.showStatus(int, int, String) line: 77<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultMinMaxMethod<T>.report() line: 296<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultMinMaxMethod<T>.process() line: 155<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultAutoscaleMethod<T>.getRange(IterableInterval<T>) line: 70<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultAutoscaleService.getDefaultIntervalRange(IterableInterval<RealType<?>>) line: 97<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultAutoscaleService.getDefaultRandomAccessRange(RandomAccessibleInterval<RealType<?>>) line: 105<span style="white-space:pre-wrap"> </span></div><div>
<span style="white-space:pre-wrap"> </span>DefaultDatasetView.autoscale(int) line: 176<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultDatasetView.initializeView(boolean) line: 499<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultDatasetView.rebuild() line: 383<span style="white-space:pre-wrap"> <font color="#0000ff">Takes the DefaultDatasetView lock.</font></span></div><div><span style="white-space:pre-wrap"> </span>DefaultImageDisplay.rebuild() line: 140<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>DefaultImageDisplay.display(Object) line: 273<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>DefaultOverlayService.addOverlays(ImageDisplay, List<Overlay>) line: 148<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>TurboRegRegister.run() line: 144<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>CommandModule.run() line: 196<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>ModuleRunner.run() line: 168<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>ModuleRunner.call() line: 129<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>ModuleRunner.call() line: 1<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>FutureTask$Sync.innerRun() line: 303<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>FutureTask<V>.run() line: 138<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>ThreadPoolExecutor$Worker.runTask(Runnable) line: 886<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>ThreadPoolExecutor$Worker.run() line: 908<span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>Thread.run() line: 662<span style="white-space:pre-wrap"> </span></div>
</div><div><br></div></div></div>
<br>_______________________________________________<br>
ImageJ-devel mailing list<br>
<a href="mailto:ImageJ-devel@imagej.net">ImageJ-devel@imagej.net</a><br>
<a href="http://imagej.net/mailman/listinfo/imagej-devel" target="_blank">http://imagej.net/mailman/listinfo/imagej-devel</a><br>
<br></blockquote></div><br></div>