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 2099ace7a4..6ab522f2f0 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 @@ -31,6 +31,7 @@ #include #include #include +#include static void display_usage(FILE *stream) { fprintf(stream, @@ -112,6 +113,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 */