Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageDisplayService concurrency issue #70

Open
ctrueden opened this issue Oct 6, 2017 · 1 comment
Open

ImageDisplayService concurrency issue #70

ctrueden opened this issue Oct 6, 2017 · 1 comment

Comments

@ctrueden
Copy link
Member

ctrueden commented Oct 6, 2017

Calling ImageDisplay.update() from multiple threads fails:

org.scijava.module.MethodCallException: Error executing method: net.imagej.MorphologicalFilters#previewChanged
	at org.scijava.module.MethodRef.execute(MethodRef.java:74)
	at org.scijava.module.AbstractModuleItem.callback(AbstractModuleItem.java:230)
	at org.scijava.widget.DefaultWidgetModel.callback(DefaultWidgetModel.java:188)
	at org.scijava.widget.DefaultWidgetModel$1.run(DefaultWidgetModel.java:177)
	at org.scijava.thread.DefaultThreadService$2.run(DefaultThreadService.java:221)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.scijava.module.MethodRef.execute(MethodRef.java:70)
	... 9 more
Caused by: java.util.ConcurrentModificationException
	at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
	at java.util.ArrayList$Itr.next(ArrayList.java:851)
	at net.imagej.display.DefaultImageDisplay.update(DefaultImageDisplay.java:298)
	at net.imagej.MorphologicalFilters.previewChanged(MorphologicalFilters.java:83)
	... 13 more
@ctrueden
Copy link
Member Author

ctrueden commented Dec 6, 2017

Ran into this again:

org.scijava.module.MethodCallException: Error executing method: kn.uni.bic.ColocalizationInfluences#translationChanged
	at org.scijava.module.MethodRef.execute(MethodRef.java:74)
	at org.scijava.module.AbstractModuleItem.callback(AbstractModuleItem.java:230)
	at org.scijava.widget.DefaultWidgetModel.callback(DefaultWidgetModel.java:188)
	at org.scijava.widget.DefaultWidgetModel$1.run(DefaultWidgetModel.java:177)
	at org.scijava.thread.DefaultThreadService$2.run(DefaultThreadService.java:221)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.scijava.module.MethodRef.execute(MethodRef.java:70)
	... 9 more
Caused by: java.util.ConcurrentModificationException
	at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
	at java.util.ArrayList$Itr.next(ArrayList.java:851)
	at net.imagej.interval.CombinedRealInterval.update(CombinedRealInterval.java:78)
	at net.imagej.display.DefaultImageDisplay.update(DefaultImageDisplay.java:297)
	at kn.uni.bic.ColocalizationInfluences.translationChanged(ColocalizationInfluences.java:250)
	... 14 more
org.scijava.module.MethodCallException: Error executing method: kn.uni.bic.ColocalizationInfluences#translationChanged
	at org.scijava.module.MethodRef.execute(MethodRef.java:74)
	at org.scijava.module.AbstractModuleItem.callback(AbstractModuleItem.java:230)
	at org.scijava.widget.DefaultWidgetModel.callback(DefaultWidgetModel.java:188)
	at org.scijava.widget.DefaultWidgetModel$1.run(DefaultWidgetModel.java:177)
	at org.scijava.thread.DefaultThreadService$2.run(DefaultThreadService.java:221)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.scijava.module.MethodRef.execute(MethodRef.java:70)
	... 9 more
Caused by: java.util.ConcurrentModificationException
	at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
	at java.util.ArrayList$Itr.next(ArrayList.java:851)
	at net.imagej.interval.CombinedRealInterval.update(CombinedRealInterval.java:78)
	at net.imagej.display.DefaultImageDisplay.update(DefaultImageDisplay.java:297)
	at kn.uni.bic.ColocalizationInfluences.translationChanged(ColocalizationInfluences.java:250)
	... 14 more

@stelfrich and I traced the culprit to DefaultImageDisplay#onEvent(DataRestructuredEvent) which spawns a new thread via ThreadService#run every time. See imagej/ImageJ@66dcd5ef2a and imagej/ImageJ@30dba64434.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant