From f5345b881d9d52e4eb932baa0b9ad8325a2c261f Mon Sep 17 00:00:00 2001 From: "gavin.wang" Date: Mon, 23 Sep 2024 15:39:15 +0800 Subject: [PATCH] YARN-11560. Fix NPE bug when multi-node enabled with schedule asynchronously (#6021). Contributed by wangzhongwei. --- .../resourcemanager/scheduler/capacity/CapacityScheduler.java | 4 ++++ 1 file changed, 4 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/capacity/CapacityScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java index ec5b074915..d4eff239ff 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java @@ -1737,6 +1737,10 @@ private CSAssignment allocateContainerOnSingleNode( private void allocateFromReservedContainer(FiCaSchedulerNode node, boolean withNodeHeartbeat, RMContainer reservedContainer) { + if(reservedContainer == null){ + LOG.warn("reservedContainer is null, that may be unreserved by the proposal judgment thread"); + return; + } FiCaSchedulerApp reservedApplication = getCurrentAttemptForContainer( reservedContainer.getContainerId()); if (reservedApplication == null) {