He Xiaoqiao created HDFS-9334:
---------------------------------

             Summary: NameNode crash caused by ArrayIndexOutOfBoundsException
                 Key: HDFS-9334
                 URL: https://issues.apache.org/jira/browse/HDFS-9334
             Project: Hadoop HDFS
          Issue Type: Bug
          Components: namenode
    Affects Versions: 2.4.1
            Reporter: He Xiaoqiao
            Assignee: He Xiaoqiao


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.
{code:title=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;
  }
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to