From 4530f4500d308c9cefbcc5990769c04bd061ad87 Mon Sep 17 00:00:00 2001 From: Weiwei Yang Date: Mon, 3 Jun 2019 14:09:37 +0800 Subject: [PATCH] YARN-9507. Fix NPE in NodeManager#serviceStop on startup failure. Contributed by Bilwa S T. --- .../hadoop/yarn/server/nodemanager/NodeManager.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java index 89e3b478d1e..9eff3a9213e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java @@ -526,9 +526,11 @@ public class NodeManager extends CompositeService DefaultMetricsSystem.shutdown(); // Cleanup ResourcePluginManager - ResourcePluginManager rpm = context.getResourcePluginManager(); - if (rpm != null) { - rpm.cleanup(); + if (null != context) { + ResourcePluginManager rpm = context.getResourcePluginManager(); + if (rpm != null) { + rpm.cleanup(); + } } } finally { // YARN-3641: NM's services stop get failed shouldn't block the