From 6bc7710ec7f2592c4c87dd940fbe5827ef81fe72 Mon Sep 17 00:00:00 2001 From: Wangda Tan Date: Fri, 20 Mar 2015 10:42:05 -0700 Subject: [PATCH] YARN-3369. Missing NullPointer check in AppSchedulingInfo causes RM to die. (Brahma Reddy Battula via wangda) --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../resourcemanager/scheduler/AppSchedulingInfo.java | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 2cfa399a69..00b2c19e76 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -802,6 +802,9 @@ Release 2.7.0 - UNRELEASED YARN-3379. Fixed missing data in localityTable and ResourceRequests table in RM WebUI. (Xuan Gong via jianhe) + YARN-3369. Missing NullPointer check in AppSchedulingInfo causes RM to die. + (Brahma Reddy Battula via wangda) + Release 2.6.0 - 2014-11-18 INCOMPATIBLE CHANGES 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/AppSchedulingInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AppSchedulingInfo.java index 97dc231815..1324c7d816 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AppSchedulingInfo.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AppSchedulingInfo.java @@ -239,7 +239,7 @@ synchronized public ResourceRequest getResourceRequest(Priority priority, public synchronized Resource getResource(Priority priority) { ResourceRequest request = getResourceRequest(priority, ResourceRequest.ANY); - return request.getCapability(); + return (request == null) ? null : request.getCapability(); } public synchronized boolean isBlacklisted(String resourceName) { @@ -382,9 +382,11 @@ synchronized private void checkForDeactivation() { boolean deactivate = true; for (Priority priority : getPriorities()) { ResourceRequest request = getResourceRequest(priority, ResourceRequest.ANY); - if (request.getNumContainers() > 0) { - deactivate = false; - break; + if (request != null) { + if (request.getNumContainers() > 0) { + deactivate = false; + break; + } } } if (deactivate) {