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

(cherry picked from commit f348ab3f2f468751af329a1ffce4917cb000fcbf)
(cherry picked from commit be6e99963ded94adf6f447ff53f2ba66b99120ca)
This commit is contained in:
Jonathan Hung 2021-02-25 15:08:43 -08:00
parent 3795f66364
commit 6863a5bb8a

View File

@ -834,6 +834,11 @@ public void updateNodeResource(RMNode nm,
try {
writeLock.lock();
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 oldResource = node.getTotalResource();
if (!oldResource.equals(newResource)) {