You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by jl...@apache.org on 2016/05/25 21:57:23 UTC
hadoop git commit: YARN-4459. container-executor should only kill
process groups. Contributed by Jun Gong (cherry picked from commit
f0520a2c94a9052e9907847cd8381844285a7f5f)
Repository: hadoop
Updated Branches:
refs/heads/branch-2.6 07b702d9d -> 7fe08d762
YARN-4459. container-executor should only kill process groups. Contributed by Jun Gong
(cherry picked from commit f0520a2c94a9052e9907847cd8381844285a7f5f)
Conflicts:
hadoop-yarn-project/CHANGES.txt
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/7fe08d76
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/7fe08d76
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/7fe08d76
Branch: refs/heads/branch-2.6
Commit: 7fe08d762faf1ef139ea95e5f78262e0eaadc744
Parents: 07b702d
Author: Jason Lowe <jl...@apache.org>
Authored: Wed May 25 21:56:50 2016 +0000
Committer: Jason Lowe <jl...@apache.org>
Committed: Wed May 25 21:56:50 2016 +0000
----------------------------------------------------------------------
hadoop-yarn-project/CHANGES.txt | 3 ++
.../impl/container-executor.c | 19 +++-------
.../test/test-container-executor.c | 37 --------------------
3 files changed, 8 insertions(+), 51 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/7fe08d76/hadoop-yarn-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index fb6ca52..dad8caf 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -30,6 +30,9 @@ Release 2.6.5 - UNRELEASED
YARN-4773. Log aggregation performs extraneous filesystem operations when
rolling log aggregation is disabled (Jun Gong via jlowe)
+ YARN-4459. container-executor should only kill process groups (Jun Gong
+ via jlowe)
+
Release 2.6.4 - 2016-02-11
INCOMPATIBLE CHANGES
http://git-wip-us.apache.org/repos/asf/hadoop/blob/7fe08d76/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c
index 9af9161..7920e4a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c
@@ -1159,21 +1159,13 @@ int signal_container_as_user(const char *user, int pid, int sig) {
}
//Don't continue if the process-group is not alive anymore.
- int has_group = 1;
if (kill(-pid,0) < 0) {
- if (kill(pid, 0) < 0) {
- if (errno == ESRCH) {
- return INVALID_CONTAINER_PID;
- }
- fprintf(LOGFILE, "Error signalling container %d with %d - %s\n",
- pid, sig, strerror(errno));
- return -1;
- } else {
- has_group = 0;
- }
+ fprintf(LOGFILE, "Error signalling not exist process group %d "
+ "with signal %d\n", pid, sig);
+ return INVALID_CONTAINER_PID;
}
- if (kill((has_group ? -1 : 1) * pid, sig) < 0) {
+ if (kill(-pid, sig) < 0) {
if(errno != ESRCH) {
fprintf(LOGFILE,
"Error signalling process group %d with signal %d - %s\n",
@@ -1187,8 +1179,7 @@ int signal_container_as_user(const char *user, int pid, int sig) {
return INVALID_CONTAINER_PID;
}
}
- fprintf(LOGFILE, "Killing process %s%d with %d\n",
- (has_group ? "group " :""), pid, sig);
+ fprintf(LOGFILE, "Killing process group %d with %d\n", pid, sig);
return 0;
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/7fe08d76/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/test/test-container-executor.c
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/test/test-container-executor.c b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/test/test-container-executor.c
index e9ac234..3aee6be 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/test/test-container-executor.c
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/test/test-container-executor.c
@@ -431,42 +431,6 @@ void run_test_in_child(const char* test_name, void (*func)()) {
}
}
-void test_signal_container() {
- printf("\nTesting signal_container\n");
- fflush(stdout);
- fflush(stderr);
- pid_t child = fork();
- if (child == -1) {
- printf("FAIL: fork failed\n");
- exit(1);
- } else if (child == 0) {
- if (change_user(user_detail->pw_uid, user_detail->pw_gid) != 0) {
- exit(1);
- }
- sleep(3600);
- exit(0);
- } else {
- printf("Child container launched as %d\n", child);
- if (signal_container_as_user(yarn_username, child, SIGQUIT) != 0) {
- exit(1);
- }
- int status = 0;
- if (waitpid(child, &status, 0) == -1) {
- printf("FAIL: waitpid failed - %s\n", strerror(errno));
- exit(1);
- }
- if (!WIFSIGNALED(status)) {
- printf("FAIL: child wasn't signalled - %d\n", status);
- exit(1);
- }
- if (WTERMSIG(status) != SIGQUIT) {
- printf("FAIL: child was killed with %d instead of %d\n",
- WTERMSIG(status), SIGQUIT);
- exit(1);
- }
- }
-}
-
void test_signal_container_group() {
printf("\nTesting group signal_container\n");
fflush(stdout);
@@ -782,7 +746,6 @@ int main(int argc, char **argv) {
// the tests that change user need to be run in a subshell, so that
// when they change user they don't give up our privs
- run_test_in_child("test_signal_container", test_signal_container);
run_test_in_child("test_signal_container_group", test_signal_container_group);
// init app and run container can't be run if you aren't testing as root
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org