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

INode.getFullPathName may throw ArrayIndexOutOfBoundsException lead to NameNode exit

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 2.7.4, 3.0.0-beta1
    • 2.8.3, 2.7.5, 3.1.0, 2.10.0, 2.9.1, 3.0.1
    • namenode
    • None

    Description

      INode.java
      public String getFullPathName() {
          // Get the full path name of this inode.
          if (isRoot()) {
            return Path.SEPARATOR;
          }
          // compute size of needed bytes for the path
          int idx = 0;
          for (INode inode = this; inode != null; inode = inode.getParent()) {
            // add component + delimiter (if not tail component)
            idx += inode.getLocalNameBytes().length + (inode != this ? 1 : 0);
          }
          byte[] path = new byte[idx];
          for (INode inode = this; inode != null; inode = inode.getParent()) {
            if (inode != this) {
              path[--idx] = Path.SEPARATOR_CHAR;
            }
            byte[] name = inode.getLocalNameBytes();
            idx -= name.length;
            System.arraycopy(name, 0, path, idx, name.length);
          }
          return DFSUtil.bytes2String(path);
        }
      

      We found ArrayIndexOutOfBoundsException at System.arraycopy(name, 0, path, idx, name.length) when ReplicaMonitor work ,and the NameNode will quit.

      It seems the two loop is not synchronized, the path's length is changed.

      Attachments

        1. HDFS-12832-branch-2.7.002.patch
          3 kB
          Konstantin Shvachko
        2. HDFS-12832-branch-2.002.patch
          3 kB
          Konstantin Shvachko
        3. HDFS-12832.002.patch
          5 kB
          Konstantin Shvachko
        4. exception.log
          1 kB
          DENG FEI
        5. HDFS-12832-trunk-001.patch
          1 kB
          DENG FEI

        Issue Links

          Activity

            People

              shv Konstantin Shvachko
              Deng FEI DENG FEI
              Votes:
              0 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: