From ac37ca0b67b2776b9f972dc69077f41935ee5812 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 --- .../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 f95b30b1e5..97e25d5caf 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 @@ -848,6 +848,11 @@ public abstract class AbstractYarnScheduler writeLock.lock(); try { 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(); final int timeout = resourceOption.getOverCommitTimeout(); Resource oldResource = node.getTotalResource();