Hadoop HDFS
  1. Hadoop HDFS
  2. HDFS-42

NetUtils.createSocketAddr NPEs if dfs.datanode.ipc.address is not set for a data node

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Duplicate
    • Affects Version/s: 0.20.1, 0.20.2, 0.21.0, 0.22.0
    • Fix Version/s: 0.21.0
    • Component/s: None
    • Labels:

      Description

      DataNode.startDatanode assumes that a configuration always returns a non-null dfs.datanode.ipc.address value, as the result is passed straight down to NetUtils.createSocketAddr

      InetSocketAddress ipcAddr = NetUtils.createSocketAddr(
      conf.get("dfs.datanode.ipc.address"));

      which triggers an NPE

      Caused by: java.lang.NullPointerException
      at org.apache.hadoop.net.NetUtils.createSocketAddr(NetUtils.java:130)
      at org.apache.hadoop.net.NetUtils.createSocketAddr(NetUtils.java:119)
      at org.apache.hadoop.dfs.DataNode.startDataNode(DataNode.java:353)
      at org.apache.hadoop.dfs.DataNode.(DataNode.java:185)

        Issue Links

          Activity

          Hide
          Steve Loughran added a comment -

          Same stack trace, same root cause

          Show
          Steve Loughran added a comment - Same stack trace, same root cause
          Hide
          Steve Loughran added a comment -

          So, what to do here?

          1. move that string in conf.get to a package scoped constant DFS_DATANODE_IPC_ADDRESS
          2. when the result of conf.get is null, raise an exception "No value defined for "+ DFS_DATANODE_IPC_ADDRESS (this could be another package scoped string)
          3. test: create a configuration without this value, try to create a datanode, look for the relevant string as the message in the exception

          Question: what exception to raise? IOException?

          Show
          Steve Loughran added a comment - So, what to do here? move that string in conf.get to a package scoped constant DFS_DATANODE_IPC_ADDRESS when the result of conf.get is null, raise an exception "No value defined for "+ DFS_DATANODE_IPC_ADDRESS (this could be another package scoped string) test: create a configuration without this value, try to create a datanode, look for the relevant string as the message in the exception Question: what exception to raise? IOException?
          Hide
          Steve Loughran added a comment -

          Reviewing this, I will go with the IOE unless anyone objects

          Show
          Steve Loughran added a comment - Reviewing this, I will go with the IOE unless anyone objects
          Hide
          Steve Loughran added a comment -

          HADOOP-5687 duplicated this; it contained the patch

          Show
          Steve Loughran added a comment - HADOOP-5687 duplicated this; it contained the patch

            People

            • Assignee:
              Steve Loughran
              Reporter:
              Steve Loughran
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development