YARN-8164. Fix a potential NPE in AbstractSchedulerPlanFollower. Contributed by lujie.

This commit is contained in:
Inigo Goiri 2018-04-16 17:32:19 -07:00
parent dd5e18c4ae
commit f1461b2487
1 changed files with 4 additions and 1 deletions

View File

@ -263,7 +263,10 @@ public abstract class AbstractSchedulerPlanFollower implements PlanFollower {
if (shouldMove) { if (shouldMove) {
moveAppsInQueueSync(expiredReservation, defReservationQueue); moveAppsInQueueSync(expiredReservation, defReservationQueue);
} }
if (scheduler.getAppsInQueue(expiredReservation).size() > 0) { List<ApplicationAttemptId> appsInQueue = scheduler.
getAppsInQueue(expiredReservation);
int size = (appsInQueue == null ? 0 : appsInQueue.size());
if (size > 0) {
scheduler.killAllAppsInQueue(expiredReservation); scheduler.killAllAppsInQueue(expiredReservation);
LOG.info("Killing applications in queue: {}", expiredReservation); LOG.info("Killing applications in queue: {}", expiredReservation);
} else { } else {