diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index d1af0b8449..991c27a5a6 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -406,6 +406,9 @@ Release 2.1.0-beta - UNRELEASED YARN-733. Fixed TestNMClient from failing occasionally. (Zhijie Shen via vinodkv) + YARN-730. Fix NMClientAsync to remove completed containers. (Zhijie Shen + via acmurthy) + BREAKDOWN OF HADOOP-8562 SUBTASKS AND RELATED JIRAS YARN-158. Yarn creating package-info.java must not depend on sh. diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/NMClientAsync.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/NMClientAsync.java index becb357104..af8f0464dc 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/NMClientAsync.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/NMClientAsync.java @@ -615,6 +615,9 @@ public void run() { LOG.info("Container " + containerId + " is already stopped or failed"); } else { container.handle(event); + if (isCompletelyDone(container)) { + containers.remove(containerId); + } } } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestNMClientAsync.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestNMClientAsync.java index bcbf94d773..e30f03e861 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestNMClientAsync.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestNMClientAsync.java @@ -122,6 +122,8 @@ public void testNMClientAsync() throws Exception { } Assert.assertEquals("Error occurs in ContainerEventProcessor", 0, ((MockNMClientAsync1) asyncClient).errorMsgs.size()); + Assert.assertEquals("Completed container is not removed", 0, + asyncClient.containers.size()); asyncClient.stop(); Assert.assertFalse( "The thread of Container Management Event Dispatcher is still alive",