Przeglądaj źródła

HDFS-8173. NPE thrown at DataNode shutdown when HTTP server was not able to create (Contributed by surendra singh lilhore)

(cherry picked from commit c17cd4f7c163cf97d6e42865df25709f29d39e3d)
Vinayakumar B 10 lat temu
rodzic
commit
c562e1b19b

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -208,6 +208,9 @@ Release 2.8.0 - UNRELEASED
 
     HDFS-8043. NPE in MiniDFSCluster teardown. (Brahma Reddy Battula via ozawa)
 
+    HDFS-8173. NPE thrown at DataNode shutdown when HTTP server was not able to
+    create (surendra singh lilhore via vinayakumarb)
+
 Release 2.7.1 - UNRELEASED
 
   INCOMPATIBLE CHANGES

+ 6 - 4
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java

@@ -1728,10 +1728,12 @@ public class DataNode extends ReconfigurableBase
         LOG.warn("Exception shutting down DataNode", e);
       }
     }
-    try {
-      httpServer.close();
-    } catch (Exception e) {
-      LOG.warn("Exception shutting down DataNode HttpServer", e);
+    if (httpServer != null) {
+      try {
+        httpServer.close();
+      } catch (Exception e) {
+        LOG.warn("Exception shutting down DataNode HttpServer", e);
+      }
     }
 
     if (pauseMonitor != null) {