From be80334cdf255616f589217726483194fb56dcc6 Mon Sep 17 00:00:00 2001 From: bibinchundatt Date: Thu, 27 Jun 2019 09:59:44 +0530 Subject: [PATCH] YARN-9639. DecommissioningNodesWatcher cause memory leak. Contributed by Bilwa S T. --- .../server/resourcemanager/DecommissioningNodesWatcher.java | 5 +++++ .../yarn/server/resourcemanager/ResourceTrackerService.java | 1 + 2 files changed, 6 insertions(+) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/DecommissioningNodesWatcher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/DecommissioningNodesWatcher.java index c476c611b36..61691690df8 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/DecommissioningNodesWatcher.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/DecommissioningNodesWatcher.java @@ -194,6 +194,11 @@ public class DecommissioningNodesWatcher { } } + public void stop() { + pollTimer.cancel(); + pollTimer = null; + } + /** * Status about a specific decommissioning node. * diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceTrackerService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceTrackerService.java index 012f58a3698..5761937959e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceTrackerService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceTrackerService.java @@ -268,6 +268,7 @@ public class ResourceTrackerService extends AbstractService implements @Override protected void serviceStop() throws Exception { + decommissioningWatcher.stop(); if (this.server != null) { this.server.stop(); }