HADOOP-12317. Applications fail on NM restart on some linux distro because NM container recovery declares AM container as LOST (adhoot via rkanter)
(cherry picked from commit 1e06299df8
)
This commit is contained in:
parent
62dfe1b7e4
commit
acf241242d
|
@ -566,6 +566,10 @@ Release 2.8.0 - UNRELEASED
|
||||||
HADOOP-12322. typos in rpcmetrics.java. (Anu Engineer via
|
HADOOP-12322. typos in rpcmetrics.java. (Anu Engineer via
|
||||||
Arpit Agarwal)
|
Arpit Agarwal)
|
||||||
|
|
||||||
|
HADOOP-12317. Applications fail on NM restart on some linux distro
|
||||||
|
because NM container recovery declares AM container as LOST
|
||||||
|
(adhoot via rkanter)
|
||||||
|
|
||||||
Release 2.7.2 - UNRELEASED
|
Release 2.7.2 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -212,13 +212,18 @@ abstract public class Shell {
|
||||||
public static String[] getCheckProcessIsAliveCommand(String pid) {
|
public static String[] getCheckProcessIsAliveCommand(String pid) {
|
||||||
return Shell.WINDOWS ?
|
return Shell.WINDOWS ?
|
||||||
new String[] { Shell.WINUTILS, "task", "isAlive", pid } :
|
new String[] { Shell.WINUTILS, "task", "isAlive", pid } :
|
||||||
new String[] { "kill", "-0", isSetsidAvailable ? "-" + pid : pid };
|
isSetsidAvailable ?
|
||||||
|
new String[] { "kill", "-0", "--", "-" + pid } :
|
||||||
|
new String[] { "kill", "-0", pid };
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return a command to send a signal to a given pid */
|
/** Return a command to send a signal to a given pid */
|
||||||
public static String[] getSignalKillCommand(int code, String pid) {
|
public static String[] getSignalKillCommand(int code, String pid) {
|
||||||
return Shell.WINDOWS ? new String[] { Shell.WINUTILS, "task", "kill", pid } :
|
return Shell.WINDOWS ?
|
||||||
new String[] { "kill", "-" + code, isSetsidAvailable ? "-" + pid : pid };
|
new String[] { Shell.WINUTILS, "task", "kill", pid } :
|
||||||
|
isSetsidAvailable ?
|
||||||
|
new String[] { "kill", "-" + code, "--", "-" + pid } :
|
||||||
|
new String[] { "kill", "-" + code, pid };
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String ENV_NAME_REGEX = "[A-Za-z_][A-Za-z0-9_]*";
|
public static final String ENV_NAME_REGEX = "[A-Za-z_][A-Za-z0-9_]*";
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
package org.apache.hadoop.util;
|
package org.apache.hadoop.util;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
import org.junit.Assert;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -150,6 +151,44 @@ public class TestShell extends TestCase {
|
||||||
System.err.println("after: " + timersAfter);
|
System.err.println("after: " + timersAfter);
|
||||||
assertEquals(timersBefore, timersAfter);
|
assertEquals(timersBefore, timersAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testGetCheckProcessIsAliveCommand() throws Exception {
|
||||||
|
String anyPid = "9999";
|
||||||
|
String[] checkProcessAliveCommand = Shell.getCheckProcessIsAliveCommand(
|
||||||
|
anyPid);
|
||||||
|
|
||||||
|
String[] expectedCommand;
|
||||||
|
|
||||||
|
if (Shell.WINDOWS) {
|
||||||
|
expectedCommand =
|
||||||
|
new String[]{ Shell.WINUTILS, "task", "isAlive", anyPid };
|
||||||
|
} else if (Shell.isSetsidAvailable) {
|
||||||
|
expectedCommand = new String[]{ "kill", "-0", "--", "-" + anyPid };
|
||||||
|
} else {
|
||||||
|
expectedCommand = new String[]{"kill", "-0", anyPid};
|
||||||
|
}
|
||||||
|
Assert.assertArrayEquals(expectedCommand, checkProcessAliveCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGetSignalKillCommand() throws Exception {
|
||||||
|
String anyPid = "9999";
|
||||||
|
int anySignal = 9;
|
||||||
|
String[] checkProcessAliveCommand = Shell.getSignalKillCommand(anySignal,
|
||||||
|
anyPid);
|
||||||
|
|
||||||
|
String[] expectedCommand;
|
||||||
|
if (Shell.WINDOWS) {
|
||||||
|
expectedCommand =
|
||||||
|
new String[]{ Shell.WINUTILS, "task", "kill", anyPid };
|
||||||
|
} else if (Shell.isSetsidAvailable) {
|
||||||
|
expectedCommand =
|
||||||
|
new String[]{ "kill", "-" + anySignal, "--", "-" + anyPid };
|
||||||
|
} else {
|
||||||
|
expectedCommand =
|
||||||
|
new String[]{ "kill", "-" + anySignal, anyPid };
|
||||||
|
}
|
||||||
|
Assert.assertArrayEquals(expectedCommand, checkProcessAliveCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void testInterval(long interval) throws IOException {
|
private void testInterval(long interval) throws IOException {
|
||||||
|
|
Loading…
Reference in New Issue