YARN-10295. CapacityScheduler NPE can cause apps to get stuck without resources. Contributed by Benjamin Teke

This commit is contained in:
Szilard Nemeth 2020-06-10 18:15:08 +02:00
parent 0c209f3f7d
commit 59b20a1ebf
1 changed files with 6 additions and 3 deletions

View File

@ -1554,11 +1554,14 @@ public class CapacityScheduler extends
}
// Do not schedule if there are any reservations to fulfill on the node
if (node.getReservedContainer() != null) {
// node.getReservedContainer() is saved to the reservedContainer variable
// to ensure that a NPE described in YARN-10295 won't occur
reservedContainer = node.getReservedContainer();
if (reservedContainer != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Skipping scheduling since node " + node.getNodeID()
+ " is reserved by application " + node.getReservedContainer()
.getContainerId().getApplicationAttemptId());
+ " is reserved by application " + reservedContainer
.getContainerId().getApplicationAttemptId());
}
return null;
}