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

NPE from Unresolved Host causes permanent DFSInputStream failures



    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.6.0
    • 3.1.0
    • hdfs-client
    • None
    • AWS Centos linux running HBase CDH 5.9.0 and HDFS CDH 5.9.0


      We recently encountered the following NPE due to the DFSInputStream storing old cached block locations from hosts which could no longer resolve.

      Caused by: java.lang.NullPointerException
      at org.apache.hadoop.hdfs.DFSClient.isLocalAddress(DFSClient.java:1122)
      at org.apache.hadoop.hdfs.shortcircuit.DomainSocketFactory.getPathInfo(DomainSocketFactory.java:148)
      at org.apache.hadoop.hdfs.BlockReaderFactory.getBlockReaderLocal(BlockReaderFactory.java:474)
      at org.apache.hadoop.hdfs.BlockReaderFactory.build(BlockReaderFactory.java:354)
      at org.apache.hadoop.hdfs.DFSInputStream.blockSeekTo(DFSInputStream.java:662)
      at org.apache.hadoop.hdfs.DFSInputStream.seekToNewSource(DFSInputStream.java:1613)
      at org.apache.hadoop.fs.FSDataInputStream.seekToNewSource(FSDataInputStream.java:127)
      HBase related stack frames trimmed

      After investigating, the DFSInputStream appears to have been open for upwards of 3-4 weeks and had cached block locations from decommissioned nodes that no longer resolve in DNS and had been shutdown and removed from the cluster 2 weeks prior. If the DFSInputStream had refreshed its block locations from the name node, it would have received alternative block locations which would not contain the decommissioned data nodes. As the above NPE leaves the non-resolving data node in the list of block locations the DFSInputStream never refreshes the block locations and all attempts to open a BlockReader for the given blocks will fail.

      In our case, we resolved the NPE by closing and re-opening every DFSInputStream in the cluster to force a purge of the block locations cache. Ideally, the DFSInputStream would re-fetch all block locations for a host which can't be resolved in DNS or at least the blocks requested.


        1. HDFS-11701.001.patch
          0.8 kB
          Lokesh Jain
        2. HDFS-11701.002.patch
          6 kB
          Lokesh Jain
        3. HDFS-11701.003.patch
          9 kB
          Lokesh Jain
        4. HDFS-11701.004.patch
          9 kB
          Lokesh Jain



            ljain Lokesh Jain
            lumost James Moore
            0 Vote for this issue
            13 Start watching this issue