Repository: hadoop
Updated Branches:
  refs/heads/branch-2 ff46db2ea -> 0e6efe06e


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/0e6efe06
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/0e6efe06
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/0e6efe06

Branch: refs/heads/branch-2
Commit: 0e6efe06ea2dd4029633c9fd98f5fc81049c7db8
Parents: ff46db2
Author: Jason Lowe <[email protected]>
Authored: Fri Jul 13 10:05:25 2018 -0500
Committer: Jason Lowe <[email protected]>
Committed: Fri Jul 13 10:11:57 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/0e6efe06/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 a1b5ebc..26bd54a 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
@@ -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 */


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to