Repository: tez
Updated Branches:
  refs/heads/branch-0.6 e4e51858b -> 26a8dcbd6


TEZ-1969. Stop the DAGAppMaster when a local mode client is stopped 
(pramachandran)

(cherry picked from commit 3e6fc355c618b77531f7d29b6a1c9cbc3c39456a)


Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/26a8dcbd
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/26a8dcbd
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/26a8dcbd

Branch: refs/heads/branch-0.6
Commit: 26a8dcbd637b47aa372a531e329ad4aac4b27048
Parents: e4e5185
Author: Prakash Ramachandran <[email protected]>
Authored: Fri Apr 17 07:54:43 2015 +0530
Committer: Prakash Ramachandran <[email protected]>
Committed: Fri Apr 24 00:06:13 2015 +0530

----------------------------------------------------------------------
 CHANGES.txt                                           |  1 +
 .../main/java/org/apache/tez/client/LocalClient.java  | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/26a8dcbd/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 573ebaf..a8d9f83 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -6,6 +6,7 @@ Release 0.6.1: Unreleased
 INCOMPATIBLE CHANGES
 
 ALL CHANGES:
+  TEZ-1969. Stop the DAGAppMaster when a local mode client is stopped
   TEZ-2329. UI Query on final dag status performance improvement
   TEZ-2287. Deprecate VertexManagerPluginContext.getTaskContainer().
   TEZ-1909. Remove need to copy over all events from attempt 1 to attempt 2 dir

http://git-wip-us.apache.org/repos/asf/tez/blob/26a8dcbd/tez-dag/src/main/java/org/apache/tez/client/LocalClient.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/client/LocalClient.java 
b/tez-dag/src/main/java/org/apache/tez/client/LocalClient.java
index bb39e13..2f8da9c 100644
--- a/tez-dag/src/main/java/org/apache/tez/client/LocalClient.java
+++ b/tez-dag/src/main/java/org/apache/tez/client/LocalClient.java
@@ -106,6 +106,14 @@ public class LocalClient extends FrameworkClient {
   public void close() throws IOException {
     // LocalClients are shared between TezClient and DAGClients, which can 
cause stop / start / close
     // to be invoked multiple times. If modifying these methods - this should 
be factored in.
+
+    // Multiple DAGClient's can reuse the LocalClient (for ex session). 
However there is only a
+    // single instance of LocalClient for a TezClient, and dagAppMaster can be 
cleaned up when
+    // the TezClient is stopped, in order not to leak.
+    if (dagAppMaster != null) {
+      dagAppMaster.stop();
+      dagAppMaster = null;
+    }
   }
 
   @Override
@@ -302,8 +310,12 @@ public class LocalClient extends FrameworkClient {
           clientHandler = new DAGClientHandler(dagAppMaster);
           DAGAppMaster.initAndStartAppMaster(dagAppMaster, 
currentUser.getShortUserName());
 
-          } catch (Throwable t) {
+        } catch (Throwable t) {
           LOG.fatal("Error starting DAGAppMaster", t);
+          if (dagAppMaster != null) {
+            dagAppMaster.stop();
+            dagAppMaster = null;
+          }
           System.exit(1);
         }
       }

Reply via email to