Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
2.4.1
-
None
-
None
Description
when remove block from list of blocks by method listRemove in BlockInfo.java, and findStorageInfo(storage) return -1 means not found, prev.setNext(prev.findStorageInfo(storage), next) or next.setPrevious(next.findStorageInfo(storage), prev) could throw ArrayIndexOutOfBoundsException cause NameNode Process exit.
BlockInfo.java
BlockInfo listRemove(BlockInfo head, DatanodeStorageInfo storage) { if(head == null) return null; int dnIndex = this.findStorageInfo(storage); if(dnIndex < 0) // this block is not on the data-node list return head; BlockInfo next = this.getNext(dnIndex); BlockInfo prev = this.getPrevious(dnIndex); this.setNext(dnIndex, null); this.setPrevious(dnIndex, null); if(prev != null) prev.setNext(prev.findStorageInfo(storage), next); if(next != null) next.setPrevious(next.findStorageInfo(storage), prev); if(this == head) // removing the head head = next; return head; }