diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 55284da2f9..a69453f352 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -739,6 +739,9 @@ Release 2.7.3 - UNRELEASED MAPREDUCE-6618. YarnClientProtocolProvider leaking the YarnClient thread. (Xuan Gong via jlowe) + MAPREDUCE-6621. Memory Leak in JobClient#submitJobInternal() (Xuan Gong + via jlowe) + Release 2.7.2 - 2016-01-25 INCOMPATIBLE CHANGES @@ -1047,6 +1050,9 @@ Release 2.6.4 - UNRELEASED MAPREDUCE-6618. YarnClientProtocolProvider leaking the YarnClient thread. (Xuan Gong via jlowe) + MAPREDUCE-6621. Memory Leak in JobClient#submitJobInternal() (Xuan Gong + via jlowe) + Release 2.6.3 - 2015-12-17 INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/JobClient.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/JobClient.java index baa622111f..c43fc0a9a0 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/JobClient.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/JobClient.java @@ -577,10 +577,18 @@ public Job run() throws IOException, ClassNotFoundException, return job; } }); + + Cluster prev = cluster; // update our Cluster instance with the one created by Job for submission // (we can't pass our Cluster instance to Job, since Job wraps the config // instance, and the two configs would then diverge) cluster = job.getCluster(); + + // It is important to close the previous cluster instance + // to cleanup resources. + if (prev != null) { + prev.close(); + } return new NetworkedJob(job); } catch (InterruptedException ie) { throw new IOException("interrupted", ie);