YARN-1401. With zero sleep-delay-before-sigkill.ms, no signal is ever sent (Gera Shegalov via Sandy Ryza)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1542038 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
43fa41fdee
commit
1a76ccbbc4
|
@ -130,6 +130,9 @@ Release 2.3.0 - UNRELEASED
|
||||||
YARN-1400. yarn.cmd uses HADOOP_RESOURCEMANAGER_OPTS. Should be
|
YARN-1400. yarn.cmd uses HADOOP_RESOURCEMANAGER_OPTS. Should be
|
||||||
YARN_RESOURCEMANAGER_OPTS. (Raja Aluri via cnauroth)
|
YARN_RESOURCEMANAGER_OPTS. (Raja Aluri via cnauroth)
|
||||||
|
|
||||||
|
YARN-1401. With zero sleep-delay-before-sigkill.ms, no signal is ever sent
|
||||||
|
(Gera Shegalov via Sandy Ryza)
|
||||||
|
|
||||||
Release 2.2.1 - UNRELEASED
|
Release 2.2.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -375,13 +375,19 @@ public class ContainerLaunch implements Callable<Integer> {
|
||||||
LOG.debug("Sending signal to pid " + processId
|
LOG.debug("Sending signal to pid " + processId
|
||||||
+ " as user " + user
|
+ " as user " + user
|
||||||
+ " for container " + containerIdStr);
|
+ " for container " + containerIdStr);
|
||||||
if (sleepDelayBeforeSigKill > 0) {
|
|
||||||
boolean result = exec.signalContainer(user,
|
final Signal signal = sleepDelayBeforeSigKill > 0
|
||||||
processId, Signal.TERM);
|
? Signal.TERM
|
||||||
LOG.debug("Sent signal to pid " + processId
|
: Signal.KILL;
|
||||||
|
|
||||||
|
boolean result = exec.signalContainer(user, processId, signal);
|
||||||
|
|
||||||
|
LOG.debug("Sent signal " + signal + " to pid " + processId
|
||||||
+ " as user " + user
|
+ " as user " + user
|
||||||
+ " for container " + containerIdStr
|
+ " for container " + containerIdStr
|
||||||
+ ", result=" + (result? "success" : "failed"));
|
+ ", result=" + (result? "success" : "failed"));
|
||||||
|
|
||||||
|
if (sleepDelayBeforeSigKill > 0) {
|
||||||
new DelayedProcessKiller(container, user,
|
new DelayedProcessKiller(container, user,
|
||||||
processId, sleepDelayBeforeSigKill, Signal.KILL, exec).start();
|
processId, sleepDelayBeforeSigKill, Signal.KILL, exec).start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,6 @@ public class TestContainerLaunch extends BaseContainerManagerTest {
|
||||||
conf.setClass(
|
conf.setClass(
|
||||||
YarnConfiguration.NM_CONTAINER_MON_RESOURCE_CALCULATOR,
|
YarnConfiguration.NM_CONTAINER_MON_RESOURCE_CALCULATOR,
|
||||||
LinuxResourceCalculatorPlugin.class, ResourceCalculatorPlugin.class);
|
LinuxResourceCalculatorPlugin.class, ResourceCalculatorPlugin.class);
|
||||||
conf.setLong(YarnConfiguration.NM_SLEEP_DELAY_BEFORE_SIGKILL_MS, 1000);
|
|
||||||
super.setup();
|
super.setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,8 +589,9 @@ public class TestContainerLaunch extends BaseContainerManagerTest {
|
||||||
AuxiliaryServiceHelper.getServiceDataFromEnv(serviceName, env));
|
AuxiliaryServiceHelper.getServiceDataFromEnv(serviceName, env));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
private void internalKillTest(boolean delayed) throws Exception {
|
||||||
public void testDelayedKill() throws Exception {
|
conf.setLong(YarnConfiguration.NM_SLEEP_DELAY_BEFORE_SIGKILL_MS,
|
||||||
|
delayed ? 1000 : 0);
|
||||||
containerManager.start();
|
containerManager.start();
|
||||||
|
|
||||||
// ////// Construct the Container-id
|
// ////// Construct the Container-id
|
||||||
|
@ -675,7 +675,8 @@ public class TestContainerLaunch extends BaseContainerManagerTest {
|
||||||
BaseContainerManagerTest.waitForContainerState(containerManager, cId,
|
BaseContainerManagerTest.waitForContainerState(containerManager, cId,
|
||||||
ContainerState.COMPLETE);
|
ContainerState.COMPLETE);
|
||||||
|
|
||||||
// container stop sends a sigterm followed by a sigkill
|
// if delayed container stop sends a sigterm followed by a sigkill
|
||||||
|
// otherwise sigkill is sent immediately
|
||||||
GetContainerStatusesRequest gcsRequest =
|
GetContainerStatusesRequest gcsRequest =
|
||||||
GetContainerStatusesRequest.newInstance(containerIds);
|
GetContainerStatusesRequest.newInstance(containerIds);
|
||||||
|
|
||||||
|
@ -690,7 +691,7 @@ public class TestContainerLaunch extends BaseContainerManagerTest {
|
||||||
// Windows, because the process is not notified when killed by winutils.
|
// Windows, because the process is not notified when killed by winutils.
|
||||||
// There is no way for the process to trap and respond. Instead, we can
|
// There is no way for the process to trap and respond. Instead, we can
|
||||||
// verify that the job object with ID matching container ID no longer exists.
|
// verify that the job object with ID matching container ID no longer exists.
|
||||||
if (Shell.WINDOWS) {
|
if (Shell.WINDOWS || !delayed) {
|
||||||
Assert.assertFalse("Process is still alive!",
|
Assert.assertFalse("Process is still alive!",
|
||||||
DefaultContainerExecutor.containerIsAlive(cId.toString()));
|
DefaultContainerExecutor.containerIsAlive(cId.toString()));
|
||||||
} else {
|
} else {
|
||||||
|
@ -713,6 +714,16 @@ public class TestContainerLaunch extends BaseContainerManagerTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDelayedKill() throws Exception {
|
||||||
|
internalKillTest(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testImmediateKill() throws Exception {
|
||||||
|
internalKillTest(false);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
@Test
|
@Test
|
||||||
public void testCallFailureWithNullLocalizedResources() {
|
public void testCallFailureWithNullLocalizedResources() {
|
||||||
|
|
Loading…
Reference in New Issue