Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YARN-11753. Ensure NM is marked unhealthy if the ProcessBuilder reports an issue with the container-executor #7290

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,12 @@ public void startLocalizer(LocalizerStartContext ctx)
Throwable cause = e.getCause() != null ? e.getCause() : e;
if (cause instanceof IOException) {
IOException io = (IOException) cause;
if (io.getMessage().contains("No such file or directory")) {
String containerExecutorPath = getContainerExecutorExecutablePath(conf);
if (io.getMessage() != null && io.getMessage().contains("Cannot run program \"" +
containerExecutorPath + "\"")) {
throw new ConfigurationException("Application " + appId + " initialization failed" +
"(exitCode=" + exitCode + "). Container executor not found at "
+ getContainerExecutorExecutablePath(conf), e);
+ containerExecutorPath, e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -671,8 +671,10 @@ protected PrivilegedOperationExecutor getPrivilegedOperationExecutor() {
}
}

// Assert that we do catch an IOException thrown by the ProcessBuilder.start method as a misconfiguration
String containerExecutorPath = lce.getContainerExecutorExecutablePath(conf);
doThrow(new PrivilegedOperationException("IO error",
new IOException("No such file or directory")))
new IOException("Cannot run program \""+ containerExecutorPath + "\"")))
.when(spyPrivilegedExecutor).executePrivilegedOperation(
any(), any(PrivilegedOperation.class),
any(), any(), anyBoolean(), anyBoolean());
Expand All @@ -686,12 +688,35 @@ protected PrivilegedOperationExecutor getPrivilegedOperationExecutor() {
.setLocId("12345")
.setDirsHandler(dirService)
.build());
Assert.fail("startLocalizer should have thrown a ConfigurationException");
Assert.fail("startLocalizer should have thrown an ConfigurationException");
} catch (ConfigurationException e) {
assertTrue("Unexpected exception " + e,
e.getMessage().contains("Container executor not found"));
}

// Assert that we do not catch every IOException as a misconfiguration
doThrow(new PrivilegedOperationException("IO error",
new IOException("No such file or directory")))
.when(spyPrivilegedExecutor).executePrivilegedOperation(
any(), any(PrivilegedOperation.class),
any(), any(), anyBoolean(), anyBoolean());

try {
lce.startLocalizer(new LocalizerStartContext.Builder()
.setNmPrivateContainerTokens(nmPrivateCTokensPath)
.setNmAddr(address)
.setUser(appSubmitter)
.setAppId(appId.toString())
.setLocId("12345")
.setDirsHandler(dirService)
.build());
Assert.fail("startLocalizer should have thrown an IOException");
} catch (ConfigurationException e) {
Assert.fail("startLocalizer should not have thrown a ConfigurationException");
} catch (IOException e) {
assertTrue("Unexpected exception " + e,
e.getMessage().contains("exitCode"));
}

doThrow(new PrivilegedOperationException("interrupted"))
.when(spyPrivilegedExecutor).executePrivilegedOperation(
Expand Down
Loading