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

abstractdog pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tez.git


The following commit(s) were added to refs/heads/master by this push:
     new 84b5bd6  TEZ-4282: Possible NPE in LocalClient after TEZ-4236 (#103) 
(Laszlo Bodor reviewed by Panagiotis Garefalakis, Ashutosh Chauhan)
84b5bd6 is described below

commit 84b5bd6e7dfb554ed3a4e9a3642f6cfbb0bb9df7
Author: Bodor Laszlo <[email protected]>
AuthorDate: Tue Feb 9 10:51:56 2021 +0100

    TEZ-4282: Possible NPE in LocalClient after TEZ-4236 (#103) (Laszlo Bodor 
reviewed by Panagiotis Garefalakis, Ashutosh Chauhan)
---
 .../main/java/org/apache/tez/client/LocalClient.java  | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

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 f6d9587..d0580bb 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
@@ -157,7 +157,9 @@ public class LocalClient extends FrameworkClient {
   @Override
   public void killApplication(ApplicationId appId) {
     try {
-      clientHandler.shutdownAM();
+      if (clientHandler != null){
+        clientHandler.shutdownAM();
+      }
     } catch (TezException e) {
       throw new RuntimeException(e);
     }
@@ -403,7 +405,13 @@ public class LocalClient extends FrameworkClient {
   @Override
   public TezAppMasterStatus getAMStatus(Configuration configuration, 
ApplicationId appId,
       UserGroupInformation ugi) throws TezException, ServiceException, 
IOException {
-    return clientHandler.getTezAppMasterStatus();
+    if (isLocalWithoutNetwork) {
+      if (clientHandler == null) {
+        return TezAppMasterStatus.INITIALIZING;
+      }
+      return clientHandler.getTezAppMasterStatus();
+    }
+    return super.getAMStatus(configuration, appId, ugi);
   }
 
   @Override
@@ -438,10 +446,11 @@ public class LocalClient extends FrameworkClient {
   public boolean shutdownSession(Configuration configuration, ApplicationId 
sessionAppId,
       UserGroupInformation ugi) throws TezException, IOException, 
ServiceException {
     if (isLocalWithoutNetwork) {
-      clientHandler.shutdownAM();
+      if (clientHandler != null){
+        clientHandler.shutdownAM();
+      }
       return true;
-    } else {
-      return super.shutdownSession(configuration, sessionAppId, ugi);
     }
+    return super.shutdownSession(configuration, sessionAppId, ugi);
   }
 }

Reply via email to