浏览代码

YARN-11787. [Federation] Enhance Exception Handling in FederationClientInterceptor#forceKillApplication. (#7465) Contributed by Shilun Fan.

Co-authored-by: Hualong Zhang <hualong.z@hotmail.com>
Signed-off-by: Shilun Fan <slfan1989@apache.org>
slfan1989 2 月之前
父节点
当前提交
1f640aa02a

+ 9 - 3
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/clientrm/FederationClientInterceptor.java

@@ -667,9 +667,15 @@ public class FederationClientInterceptor
       // If kill home sub-cluster application is successful,
       // we will try to kill the same application in other sub-clusters.
       if (response != null) {
-        ClientMethod remoteMethod = new ClientMethod("forceKillApplication",
-            new Class[]{KillApplicationRequest.class}, new Object[]{request});
-        invokeConcurrent(remoteMethod, KillApplicationResponse.class, subClusterId);
+        try {
+          ClientMethod remoteMethod = new ClientMethod("forceKillApplication",
+              new Class[]{KillApplicationRequest.class}, new Object[]{request});
+          invokeConcurrent(remoteMethod, KillApplicationResponse.class, subClusterId);
+        } catch (YarnException e) {
+          // We cannot confirm whether the application exists in other sub-clusters,
+          // so this method may throw an error, which we should ignore.
+          LOG.warn("The execution of forceKillApplication failed in the sub-cluster.", e);
+        }
       }
     } catch (Exception e) {
       routerMetrics.incrAppsFailedKilled();