Repository: hadoop Updated Branches: refs/heads/branch-3.0 883df537d -> 1ae35834a
YARN-8515. container-executor can crash with SIGPIPE after nodemanager restart. Contributed by Jim Brennan (cherry picked from commit 17118f446c2387aa796849da8b69a845d9d307d3) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/1ae35834 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/1ae35834 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/1ae35834 Branch: refs/heads/branch-3.0 Commit: 1ae35834a28258d4a3d37173c47ec4764e8a3467 Parents: 883df53 Author: Jason Lowe <[email protected]> Authored: Fri Jul 13 10:05:25 2018 -0500 Committer: Jason Lowe <[email protected]> Committed: Fri Jul 13 10:08:21 2018 -0500 ---------------------------------------------------------------------- .../src/main/native/container-executor/impl/main.c | 6 ++++++ 1 file changed, 6 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/1ae35834/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/main.c ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/main.c b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/main.c index 5c327cf..dafb3d0 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/main.c +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/main.c @@ -30,6 +30,7 @@ #include <unistd.h> #include <stdlib.h> #include <string.h> +#include <signal.h> static void display_usage(FILE *stream) { fprintf(stream, @@ -106,6 +107,11 @@ static void open_log_files() { if (ERRORFILE == NULL) { ERRORFILE = stderr; } + + // There may be a process reading from stdout/stderr, and if it + // exits, we will crash on a SIGPIPE when we try to write to them. + // By ignoring SIGPIPE, we can handle the EPIPE instead of crashing. + signal(SIGPIPE, SIG_IGN); } /* Flushes and closes log files */ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
