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

NPE while DN is shutting down

VotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.0
    • Component/s: None
    • Labels:
      None

      Description

      Take the code BPServiceActor#register:

      while (shouldRun()) {
      try {
         // Use returned registration from namenode with updated fields
          newBpRegistration = bpNamenode.registerDatanode(newBpRegistration);
          newBpRegistration.setNamespaceInfo(nsInfo);
          bpRegistration = newBpRegistration;
          break;
      } catch(EOFException e) { // namenode might have just restarted
          ....
      }
      
      LOG.info("Block pool " + this + " successfully registered with NN");
      bpos.registrationSucceeded(this, bpRegistration);
      

      if DN is shutdown, then above code will skip the loop, and bpRegistration  == null, the null value will be used  in DataNode#bpRegistrationSucceeded:

      if(!storage.getDatanodeUuid().equals(bpRegistration.getDatanodeUuid()))
      

      hence NPE happens

      java.lang.NullPointerException
      at org.apache.hadoop.hdfs.server.datanode.DataNode.bpRegistrationSucceeded(DataNode.java:1583)
      at org.apache.hadoop.hdfs.server.datanode.BPOfferService.registrationSucceeded(BPOfferService.java:425)
      at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.register(BPServiceActor.java:807)
      at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.connectToNNAndHandshake(BPServiceActor.java:294)
      at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.run(BPServiceActor.java:840)
      at java.lang.Thread.run(Thread.java:745)
      
      

        Attachments

        1. HDFS-14372_0.patch
          1.0 kB
          lujie
        2. HDFS-14372_1.patch
          4 kB
          lujie
        3. HDFS-14372_2.patch
          4 kB
          lujie

          Activity

            People

            • Assignee:
              xiaoheipangzi lujie
              Reporter:
              xiaoheipangzi lujie

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment