You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by sn...@apache.org on 2020/06/10 16:15:24 UTC

[hadoop] branch branch-3.1 updated: YARN-10295. CapacityScheduler NPE can cause apps to get stuck without resources. Contributed by Benjamin Teke

This is an automated email from the ASF dual-hosted git repository.

snemeth pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new 59b20a1e YARN-10295. CapacityScheduler NPE can cause apps to get stuck without resources. Contributed by Benjamin Teke
59b20a1e is described below

commit 59b20a1ebf591b790c01781acaa5f731f2b7b1bd
Author: Szilard Nemeth <sn...@apache.org>
AuthorDate: Wed Jun 10 18:15:08 2020 +0200

    YARN-10295. CapacityScheduler NPE can cause apps to get stuck without resources. Contributed by Benjamin Teke
---
 .../resourcemanager/scheduler/capacity/CapacityScheduler.java    | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

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/capacity/CapacityScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java
index 40f575d..71ff806 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java
@@ -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;
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org