Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-1195

NullPointerException in FSNamesystem due to getDatanode() return value is not checked

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.16.0
    • None
    • None

    Description

      FSNamesystem.getDatanode( nodeID ) returns null if the node is not found.
      There are several places where we do not check wether the returned node is null, e.g.
      FSNamesystem.processReport()
      FSNamesystem.setDatanodeDead()
      FSNamesystem.invalidateBlock()
      FSNamesystem.verifyNodeRegistration()

      I'm getting the following NPE:

      07/04/02 17:31:50 WARN dfs.DataNode: org.apache.hadoop.ipc.RemoteException: java.io.IOException: java.lang.NullPointerException
      at org.apache.hadoop.dfs.FSNamesystem.shouldNodeShutdown(FSNamesystem.java:3306)
      at org.apache.hadoop.dfs.FSNamesystem.processReport(FSNamesystem.java:2012)
      at org.apache.hadoop.dfs.NameNode.blockReport(NameNode.java:654)
      at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:341)
      at org.apache.hadoop.ipc.Server$Handler.run(Server.java:580)

      at org.apache.hadoop.ipc.Client.call(Client.java:473)
      at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:164)
      at org.apache.hadoop.dfs.$Proxy1.blockReport(Unknown Source)
      at org.apache.hadoop.dfs.DataNode.offerService(DataNode.java:460)
      at org.apache.hadoop.dfs.DataNode.run(DataNode.java:1095)
      at org.apache.hadoop.dfs.MiniDFSCluster$DataNodeRunner.run(MiniDFSCluster.java:160)
      at java.lang.Thread.run(Thread.java:595)

      Attachments

        1. datanodeNullPointer.patch
          2 kB
          Dhruba Borthakur
        2. datanodeNullPointer.patch
          2 kB
          Dhruba Borthakur
        3. datanodeNullPointer.patch
          2 kB
          Dhruba Borthakur

        Activity

          People

            dhruba Dhruba Borthakur
            shv Konstantin Shvachko
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: