Skip to content

TamuraFeature2dTest#testCoarsenessFeature AIOOBE #99

Closed
scijava/incubator
#64

Description

@hinerm

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.

Activity

  1. hinerm commented on Oct 19, 2022

    @hinerm
    MemberAuthor

    @gselzer @ctrueden should there be/is there a way to control if a neighborhood map is multithreaded or not?

  2. added this to the 1.0.0 milestone on Oct 19, 2022
  3. gselzer commented on Oct 19, 2022

    @gselzer
    Member

    This leads me to believe that the OpHistory is not threadsafe.

    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...

    @gselzer @ctrueden should there be/is there a way to control if a neighborhood map is multithreaded or not?

    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?

  4. ctrueden commented on Oct 21, 2022

    @ctrueden
    Member

    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 the Progress class, but that's a different thing than the OpHistory. I briefly scanned the open PRs, thinking maybe a ThreadLocal for the OpHistory was added but not yet merged to main, but didn't see anything obvious.

  5. hinerm commented on Oct 21, 2022

    @hinerm
    MemberAuthor

    See also #101

  6. added a commit that references this issue on May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions