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 su...@apache.org on 2019/11/19 08:35:27 UTC

[hadoop] branch branch-3.2 updated: YARN-9984. FSPreemptionThread can cause NullPointerException while app is unregistered with containers running on a node. Contributed by Wilfred Spiegelenburg.

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

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


The following commit(s) were added to refs/heads/branch-3.2 by this push:
     new 049279b  YARN-9984. FSPreemptionThread can cause NullPointerException while app is unregistered with containers running on a node. Contributed by Wilfred Spiegelenburg.
049279b is described below

commit 049279bb66b036b4767fe6a0283a6f334ac91440
Author: Sunil G <su...@apache.org>
AuthorDate: Tue Nov 19 14:03:02 2019 +0530

    YARN-9984. FSPreemptionThread can cause NullPointerException while app is unregistered with containers running on a node. Contributed by Wilfred Spiegelenburg.
    
    (cherry picked from commit 215f2052fc3b7e366e8bd1bd332663966fa9206c)
---
 .../scheduler/fair/FSPreemptionThread.java              | 17 ++++++++++++++---
 1 file changed, 14 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/fair/FSPreemptionThread.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSPreemptionThread.java
index 7ccfd72..fe445b6 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSPreemptionThread.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSPreemptionThread.java
@@ -141,9 +141,13 @@ class FSPreemptionThread extends Thread {
             for (RMContainer container : containers) {
               FSAppAttempt app = scheduler.getSchedulerApp(
                       container.getApplicationAttemptId());
-              LOG.info("Preempting container " + container +
-                      " from queue " + app.getQueueName());
-              app.trackContainerForPreemption(container);
+              LOG.info("Preempting container " + container + " from queue: "
+                  + (app != null ? app.getQueueName() : "unknown"));
+              // If the app has unregistered while building the container list
+              // the app might be null, skip notifying the app
+              if (app != null) {
+                app.trackContainerForPreemption(container);
+              }
             }
           }
         }
@@ -205,6 +209,13 @@ class FSPreemptionThread extends Thread {
     for (RMContainer container : containersToCheck) {
       FSAppAttempt app =
           scheduler.getSchedulerApp(container.getApplicationAttemptId());
+      // If the app has unregistered while building the container list the app
+      // might be null, just skip this container: it should be cleaned up soon
+      if (app == null) {
+        LOG.info("Found container " + container + " on node "
+            + node.getNodeName() + "without app, skipping preemption");
+        continue;
+      }
       ApplicationId appId = app.getApplicationId();
 
       if (app.canContainerBePreempted(container,


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