From c017171da00a6cd71a2901c84a0298ce14a49e23 Mon Sep 17 00:00:00 2001 From: Jason Lowe Date: Fri, 28 Oct 2016 14:57:50 +0000 Subject: [PATCH] HADOOP-13770. Shell.checkIsBashSupported swallowed an interrupted exception. Contributed by Wei-Chiu Chuang --- .../src/main/java/org/apache/hadoop/util/Shell.java | 6 ++++-- .../apache/hadoop/yarn/server/nodemanager/NodeManager.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java index 78f77c2410..0745057270 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java @@ -734,8 +734,7 @@ public static File getWinUtilsFile() throws FileNotFoundException { } } - public static final boolean isBashSupported = checkIsBashSupported(); - private static boolean checkIsBashSupported() { + public static boolean checkIsBashSupported() throws InterruptedIOException { if (Shell.WINDOWS) { return false; } @@ -746,6 +745,9 @@ private static boolean checkIsBashSupported() { String[] args = {"bash", "-c", "echo 1000"}; shexec = new ShellCommandExecutor(args); shexec.execute(); + } catch (InterruptedIOException iioe) { + LOG.warn("Interrupted, unable to determine if bash is supported", iioe); + throw iioe; } catch (IOException ioe) { LOG.warn("Bash is not supported by the OS", ioe); supported = false; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java index 37f67c458a..542446463d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java @@ -750,7 +750,7 @@ private void initAndStartNodeManager(Configuration conf, boolean hasToReboot) { // Failed to start if we're a Unix based system but we don't have bash. // Bash is necessary to launch containers under Unix-based systems. if (!Shell.WINDOWS) { - if (!Shell.isBashSupported) { + if (!Shell.checkIsBashSupported()) { String message = "Failing NodeManager start since we're on a " + "Unix-based system but bash doesn't seem to be available.";