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 bi...@apache.org on 2019/08/26 17:56:04 UTC

[hadoop] branch branch-3.1 updated: YARN-9642. Fix Memory Leak in AbstractYarnScheduler caused by timer. Contributed by Bibin A Chundatt.

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

bibinchundatt 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 eb618e4  YARN-9642. Fix Memory Leak in AbstractYarnScheduler caused by timer. Contributed by Bibin A Chundatt.
eb618e4 is described below

commit eb618e4f22994ceb6e9ed928b82a703171d65bdb
Author: bibinchundatt <bi...@apache.org>
AuthorDate: Mon Aug 26 23:21:33 2019 +0530

    YARN-9642. Fix Memory Leak in AbstractYarnScheduler caused by timer. Contributed by Bibin A Chundatt.
    
    (cherry picked from commit d3ce53e5073e35e162f1725836282e4268cd26a5)
---
 .../resourcemanager/scheduler/AbstractYarnScheduler.java     | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 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/AbstractYarnScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java
index 5c457e6..10c5b97 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java
@@ -141,6 +141,7 @@ public abstract class AbstractYarnScheduler
   @VisibleForTesting
   Thread updateThread;
   private final Object updateThreadMonitor = new Object();
+  private Timer releaseCache;
 
   /*
    * All schedulers which are inheriting AbstractYarnScheduler should use
@@ -201,7 +202,7 @@ public abstract class AbstractYarnScheduler
     nodeTracker.setConfiguredMaxAllocationWaitTime(
         configuredMaximumAllocationWaitTime);
     maxClusterLevelAppPriority = getMaxPriorityFromConf(conf);
-    createReleaseCache();
+    this.releaseCache = new Timer("Pending Container Clear Timer");
     autoUpdateContainers =
         conf.getBoolean(YarnConfiguration.RM_AUTO_UPDATE_CONTAINERS,
             YarnConfiguration.DEFAULT_RM_AUTO_UPDATE_CONTAINERS);
@@ -223,6 +224,7 @@ public abstract class AbstractYarnScheduler
       updateThread.start();
     }
     schedulingMonitorManager.startAll();
+    createReleaseCache();
     super.serviceStart();
   }
 
@@ -232,6 +234,12 @@ public abstract class AbstractYarnScheduler
       updateThread.interrupt();
       updateThread.join(THREAD_JOIN_TIMEOUT_MS);
     }
+
+    //Stop Timer
+    if (releaseCache != null) {
+      releaseCache.cancel();
+      releaseCache = null;
+    }
     schedulingMonitorManager.stop();
     super.serviceStop();
   }
@@ -632,7 +640,7 @@ public abstract class AbstractYarnScheduler
 
   protected void createReleaseCache() {
     // Cleanup the cache after nm expire interval.
-    new Timer().schedule(new TimerTask() {
+    releaseCache.schedule(new TimerTask() {
       @Override
       public void run() {
         clearPendingContainerCache();


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