Repository navigation
Closed
scijava/incubator
#64Description
Following from scijava/incubator#62 (comment)
When running testCoarsenessFeature in an IDE (IntelliJ, windows) it will throw an ArrayIndexOutOfBoundsException with the following stack trace:
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 10000 out of bounds for length 10000
at net.imglib2@5.12.0/net.imglib2.img.basictypeaccess.array.AbstractByteArray.getValue(AbstractByteArray.java:61)
at net.imglib2@5.12.0/net.imglib2.type.numeric.integer.GenericByteType.getByte(GenericByteType.java:137)
at net.imglib2@5.12.0/net.imglib2.type.numeric.integer.GenericByteType.valueEquals(GenericByteType.java:243)
at net.imglib2@5.12.0/net.imglib2.type.numeric.integer.GenericByteType.equals(GenericByteType.java:253)
at java.base/java.util.WeakHashMap.eq(WeakHashMap.java:287)
at java.base/java.util.WeakHashMap.getEntry(WeakHashMap.java:431)
at java.base/java.util.WeakHashMap.containsKey(WeakHashMap.java:418)
at org.scijava.ops.engine@0-SNAPSHOT/org.scijava.ops.engine.DefaultOpHistory.logOutput(DefaultOpHistory.java:77)
at org.scijava.ops.engine@0-SNAPSHOT/org.scijava.ops.engine.matcher.impl.AbstractRichOp.postprocess(AbstractRichOp.java:54)
at org.scijava.ops.engine@0-SNAPSHOT/org.scijava.ops.engine.matcher.impl.OpWrappers$Computer1OpWrapper$1GenericTypedComputer1.compute(OpWrappers.java:806)
at net.imagej.ops2@0-SNAPSHOT/net.imagej.ops2.map.neighborhood.MapNeighborhoodAllRAI.lambda$compute$0(DefaultMapNeighborhood.java:116)
at net.imglib2.loops.BindActionToSamplers$BiConsumerRunnable.run(BindActionToSamplers.java:144)
at net.imglib2.loops.LoopUtils$LineProcessor.run(LoopUtils.java:147)
at net.imglib2.loops.LoopUtils$LineProcessor.run(LoopUtils.java:147)
at net.imglib2@5.12.0/net.imglib2.loops.LoopBuilder.lambda$runOnChunkUsingRandomAccesses$3(LoopBuilder.java:367)
at net.imglib2@5.12.0/net.imglib2.loops.LoopBuilder.lambda$forEachPixel$0(LoopBuilder.java:159)
at net.imglib2@5.12.0/net.imglib2.loops.LoopBuilder.runOnChunkUsingRandomAccesses(LoopBuilder.java:365)
at net.imglib2@5.12.0/net.imglib2.loops.LoopBuilder.lambda$runUsingRandomAccesses$2(LoopBuilder.java:356)
at net.imglib2@5.12.0/net.imglib2.parallel.DefaultTaskExecutor.lambda$forEachApply$1(DefaultTaskExecutor.java:118)
at java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1448)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
Some observations:
- If I comment out this line in the
DefaultOpHistory, I do not see the exception - If I make this LoopBuilder not multithreaded, I do not see this exception
This leads me to believe that the OpHistory is not threadsafe.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
hinerm commentedon Oct 19, 2022
@gselzer @ctrueden should there be/is there a way to control if a neighborhood map is multithreaded or not?
gselzer commentedon Oct 19, 2022
Huh, I thought that @ctrueden and I had made efforts to make it so, using
ThreadLocal. Still, I wouldn't be surprised if it isn't...I don't think there is a way, but I'm not sure I understand why you'd want to control that. Do you have a situation in mind where you wouldn't want multithreaded mapping?
ctrueden commentedon Oct 21, 2022
For the record, I have also seen this AIOOBE during command line build at least once.
@hinerm The way to control the multithreading will be with scijava-concurrent, defined in scijava/incubator#33.
@gselzer About
ThreadLocal: it looks like we are using one for theProgressclass, but that's a different thing than theOpHistory. I briefly scanned the open PRs, thinking maybe aThreadLocalfor theOpHistorywas added but not yet merged to main, but didn't see anything obvious.hinerm commentedon Oct 21, 2022
See also #101
Merge pull request #99 from scijava/scijava/incubator/remove-required…