Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-9334

NameNode crash caused by ArrayIndexOutOfBoundsException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 2.4.1
    • None
    • namenode
    • 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;
        }
      

      Attachments

        Issue Links

          Activity

            People

              hexiaoqiao Xiaoqiao He
              hexiaoqiao Xiaoqiao He
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: