From cc460fea2d90f5061521d7fdf3ca712eb4145e14 Mon Sep 17 00:00:00 2001 From: Wangda Tan Date: Fri, 1 Jun 2018 13:58:46 -0700 Subject: [PATCH] YARN-8384. stdout.txt, stderr.txt logs of a launched docker container is coming with primary group of submit user instead of hadoop. (Eric Yang via wangda) Change-Id: Idbb2cd250f4f62dc32993e0d3ca3ec5684616baa (cherry picked from commit 3a6bd775500343632bad5f9c1a2bfacd408f7760) --- .../main/native/container-executor/impl/container-executor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 7b622235bcd..1b8842a01c9 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 @@ -1140,8 +1140,8 @@ char *init_log_path(const char *container_log_dir, const char *logfile) { int fd = open(tmp_buffer, O_CREAT | O_WRONLY, permissions); if (fd >= 0) { close(fd); - if (change_owner(tmp_buffer, user_detail->pw_uid, user_detail->pw_gid) != 0) { - fprintf(ERRORFILE, "Failed to chown %s to %d:%d: %s\n", tmp_buffer, user_detail->pw_uid, user_detail->pw_gid, + if (change_owner(tmp_buffer, user_detail->pw_uid, nm_gid) != 0) { + fprintf(ERRORFILE, "Failed to chown %s to %d:%d: %s\n", tmp_buffer, user_detail->pw_uid, nm_gid, strerror(errno)); free(tmp_buffer); tmp_buffer = NULL;