Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Fail to read queue. #203

Description

@chrisjenx

We run while(queue.size() > 2000) queue.remove() to prune our queue if it's getting to long, but after upgrading to Tape 2 we keep getting:

Caused by java.lang.ArrayIndexOutOfBoundsException: length=32; regionStart=0; regionLength=-1350298417
       at java.util.Arrays.checkOffsetAndCount(Arrays.java:136)
       at libcore.io.IoBridge.read(IoBridge.java:523)
       at java.io.RandomAccessFile.readBytes(RandomAccessFile.java:336)
       at java.io.RandomAccessFile.read(RandomAccessFile.java:365)
       at java.io.RandomAccessFile.readFully(RandomAccessFile.java:424)
       at com.squareup.tape2.QueueFile.ringRead(QueueFile.java:350)
       at com.squareup.tape2.QueueFile.remove(QueueFile.java:631)
       at com.squareup.tape2.QueueFile.remove(QueueFile.java:595)
       at com.squareup.tape2.FileObjectQueue.remove(FileObjectQueue.java:47)
       at com.instacart.instashopper.v2.log.logdna.ISLogDnaTree.logSynchronized(ISLogDnaTree.kt:81)
       at com.instacart.instashopper.v2.log.logdna.ISLogDnaTree.access$logSynchronized(ISLogDnaTree.kt:28)
       at com.instacart.instashopper.v2.log.logdna.ISLogDnaTree$logOnTapeScheduler$1.call(ISLogDnaTree.kt:89)
       at com.instacart.instashopper.v2.log.logdna.ISLogDnaTree$logOnTapeScheduler$1.call(ISLogDnaTree.kt:28)
       at io.reactivex.internal.operators.observable.ObservableFromCallable.subscribeActual(ObservableFromCallable.java:43)
       at io.reactivex.Observable.subscribe(Observable.java:12090)
       at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
       at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
       at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
       at java.lang.Thread.run(Thread.java:764)

I've been writing tests to try and reproduce the issue, but I can only seem to randomly make it happen on a device.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions