YARN-8515. container-executor can crash with SIGPIPE after nodemanager restart. Contributed by Jim Brennan

(cherry picked from commit 17118f446c2387aa796849da8b69a845d9d307d3)
This commit is contained in:
Jason Lowe 2018-07-13 10:05:25 -05:00
parent ff46db2ea6
commit 0e6efe06ea

View File

@ -28,6 +28,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
static void display_usage(FILE *stream) {
fprintf(stream,
@ -104,6 +105,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 */