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

DFSClient NPE due to missing block when opening a file

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.0.0
    • None
    • hdfs-client
    • None

    Description

      I saw the following NPE for a client on branch-1 that looks like it accessed a block not in the volume map, probably because the block was already deleted (otherwise the primary should have a block file). Looks like a create is racing with a delete.

      DFSClient.java in updateBlockInfo..

      Block newBlock = primary.getBlockInfo(last.getBlock());
      long newBlockSize = newBlock.getNumBytes();    <--------
      

      From getBlockInfo to getStoredBlock..

        public synchronized Block getStoredBlock(long blkid) throws IOException {
          File blockfile = findBlockFile(blkid);
          if (blockfile == null) {
            return null;
          }
      

      Digging into findBlockFile..

        public synchronized File findBlockFile(long blockId) {
          final Block b = new Block(blockId);
          File blockfile = null;
          ActiveFile activefile = ongoingCreates.get(b);
          if (activefile != null) {
            blockfile = activefile.file;
          }
          if (blockfile == null) {
            blockfile = getFile(b);
          }
          if (blockfile == null) {
            if (DataNode.LOG.isDebugEnabled()) {
              DataNode.LOG.debug("ongoingCreates=" + ongoingCreates);
              DataNode.LOG.debug("volumeMap=" + volumeMap);
            }
          }
          return blockfile;
      

      Into getFile..

        public synchronized File getFile(Block b) {
          DatanodeBlockInfo info = volumeMap.get(b);
          if (info != null) {
            return info.getFile();
          }
          return null;
      

      Attachments

        Activity

          People

            eli Eli Collins
            eli Eli Collins
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated: