Skip to content

fix issue #415#425

Open
slowlow79464 wants to merge 1 commit intolingochamp:masterfrom
slowlow79464:master
Open

fix issue #415#425
slowlow79464 wants to merge 1 commit intolingochamp:masterfrom
slowlow79464:master

Conversation

@slowlow79464
Copy link

When close the outputstrem, remove it from outputStreamMap but not remove it from noSyncLengthMap. That lead to syncRunnable crash cause java.lang.ArrayIndexOutOfBoundsException at function 'flushProcess' in class MultiPointOutputStream.java. The code is :

    synchronized (noSyncLengthMap) {
        // make sure the length of noSyncLengthMap is equal to outputStreamMap
        size = noSyncLengthMap.size();
    }

    final SparseArray<Long> increaseLengthMap = new SparseArray<>(size);

    try {
        for (int i = 0; i < size; i++) {
            final int blockIndex = outputStreamMap.keyAt(i);

The crash is at outputStreamMap.keyAt(i);

so when download at multiblock, and one of the outputstreams is close, the syncRunnable may crash, and will not do flushProces whitch update the currentOffset of blockInfo.

finally it will throw exception at here.

 public void inspectComplete(int blockIndex) throws IOException {
        final BlockInfo blockInfo = info.getBlock(blockIndex);
        if (!Util.isCorrectFull(blockInfo.getCurrentOffset(), blockInfo.getContentLength())) {
            throw new IOException("The current offset on block-info isn't update correct, "
                    + blockInfo.getCurrentOffset() + " != " + blockInfo.getContentLength()
                    + " on " + blockIndex);
        }
    }

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

Successfully merging this pull request may close these issues.

1 participant