From 67f239c42f676237290d18ddbbc9aec369267692 Mon Sep 17 00:00:00 2001 From: Weiwei Yang Date: Mon, 7 May 2018 11:33:14 +0800 Subject: [PATCH] YARN-8025. UsersManangers#getComputedResourceLimitForActiveUsers throws NPE due to preComputedActiveUserLimit is empty. Contributed by Tao Yang. --- .../resourcemanager/scheduler/capacity/UsersManager.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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/UsersManager.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/UsersManager.java index 7287c5b7c3b..747a488a5a5 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/UsersManager.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/UsersManager.java @@ -490,11 +490,12 @@ public class UsersManager implements AbstractUsersManager { Resource clusterResource, String nodePartition, SchedulingMode schedulingMode) { - Map userLimitPerSchedulingMode = preComputedActiveUserLimit - .get(nodePartition); + Map userLimitPerSchedulingMode; try { writeLock.lock(); + userLimitPerSchedulingMode = + preComputedActiveUserLimit.get(nodePartition); if (isRecomputeNeeded(schedulingMode, nodePartition, true)) { // recompute userLimitPerSchedulingMode = reComputeUserLimits(userName, @@ -548,11 +549,11 @@ public class UsersManager implements AbstractUsersManager { Resource clusterResource, String nodePartition, SchedulingMode schedulingMode) { - Map userLimitPerSchedulingMode = preComputedAllUserLimit - .get(nodePartition); + Map userLimitPerSchedulingMode; try { writeLock.lock(); + userLimitPerSchedulingMode = preComputedAllUserLimit.get(nodePartition); if (isRecomputeNeeded(schedulingMode, nodePartition, false)) { // recompute userLimitPerSchedulingMode = reComputeUserLimits(userName,