YARN-10651. CapacityScheduler crashed with NPE in AbstractYarnScheduler.updateNodeResource(). Contributed by Haibo Chen

(cherry picked from commit f348ab3f2f468751af329a1ffce4917cb000fcbf)
(cherry picked from commit be6e99963d)
(cherry picked from commit 6863a5bb8a)
(cherry picked from commit eb6c08e423)
This commit is contained in:
Jonathan Hung 2021-02-25 15:08:43 -08:00
parent 4ed7b80b19
commit 1d76a8e73f
1 changed files with 5 additions and 0 deletions

View File

@ -805,6 +805,11 @@ public abstract class AbstractYarnScheduler
try { try {
writeLock.lock(); writeLock.lock();
SchedulerNode node = getSchedulerNode(nm.getNodeID()); SchedulerNode node = getSchedulerNode(nm.getNodeID());
if (node == null) {
LOG.info("Node: " + nm.getNodeID() + " has already been taken out of " +
"scheduling. Skip updating its resource");
return;
}
Resource newResource = resourceOption.getResource(); Resource newResource = resourceOption.getResource();
Resource oldResource = node.getTotalResource(); Resource oldResource = node.getTotalResource();
if (!oldResource.equals(newResource)) { if (!oldResource.equals(newResource)) {