From 23f9508a898d7e2cbaddf694706415a402f415eb 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. (cherry picked from commit 4530f4500d308c9cefbcc5990769c04bd061ad87) --- .../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 b54a6b7400e..cd4171adbb0 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 @@ -488,9 +488,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