From 1d76a8e73fa0c13609fb5a8c9835fd012c5d8790 Mon Sep 17 00:00:00 2001 From: Jonathan Hung Date: Thu, 25 Feb 2021 15:08:43 -0800 Subject: [PATCH] YARN-10651. CapacityScheduler crashed with NPE in AbstractYarnScheduler.updateNodeResource(). Contributed by Haibo Chen (cherry picked from commit f348ab3f2f468751af329a1ffce4917cb000fcbf) (cherry picked from commit be6e99963ded94adf6f447ff53f2ba66b99120ca) (cherry picked from commit 6863a5bb8ace591de3374102920bba916dbebfda) (cherry picked from commit eb6c08e423dd06bf37ff44665ffb98c97e26ad08) --- .../resourcemanager/scheduler/AbstractYarnScheduler.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java index 30273d07438..84095ce4a03 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java @@ -805,6 +805,11 @@ public abstract class AbstractYarnScheduler try { writeLock.lock(); SchedulerNode node = getSchedulerNode(nm.getNodeID()); + if (node == null) { + LOG.info("Node: " + nm.getNodeID() + " has already been taken out of " + + "scheduling. Skip updating its resource"); + return; + } Resource newResource = resourceOption.getResource(); Resource oldResource = node.getTotalResource(); if (!oldResource.equals(newResource)) {