diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/reservation/AbstractSchedulerPlanFollower.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/reservation/AbstractSchedulerPlanFollower.java index 9b6a0b0cef..11811f123d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/reservation/AbstractSchedulerPlanFollower.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/reservation/AbstractSchedulerPlanFollower.java @@ -263,7 +263,10 @@ protected void cleanupExpiredQueues(String planQueueName, boolean shouldMove, if (shouldMove) { moveAppsInQueueSync(expiredReservation, defReservationQueue); } - if (scheduler.getAppsInQueue(expiredReservation).size() > 0) { + List appsInQueue = scheduler. + getAppsInQueue(expiredReservation); + int size = (appsInQueue == null ? 0 : appsInQueue.size()); + if (size > 0) { scheduler.killAllAppsInQueue(expiredReservation); LOG.info("Killing applications in queue: {}", expiredReservation); } else {