aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2018-02-16 09:55:08 +0100
committerLukas Larsson <[email protected]>2018-02-16 09:57:15 +0100
commitcff8dce026edfa86d0c96aebfbb8af53fee238a6 (patch)
tree2c01cb472b0b1788b218db1eb8c5332fdf923e0d
parent9e7b328be93eccaabaf22ff8081772031731026e (diff)
downloadotp-cff8dce026edfa86d0c96aebfbb8af53fee238a6.tar.gz
otp-cff8dce026edfa86d0c96aebfbb8af53fee238a6.tar.bz2
otp-cff8dce026edfa86d0c96aebfbb8af53fee238a6.zip
erts: Ignore SIGTERM in erl_child_setup
-rw-r--r--erts/emulator/sys/unix/erl_child_setup.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/erts/emulator/sys/unix/erl_child_setup.c b/erts/emulator/sys/unix/erl_child_setup.c
index 69fc6c2879..57973b10d7 100644
--- a/erts/emulator/sys/unix/erl_child_setup.c
+++ b/erts/emulator/sys/unix/erl_child_setup.c
@@ -437,6 +437,21 @@ main(int argc, char *argv[])
exit(1);
}
+ /* Ignore SIGTERM.
+ Some container environments send SIGTERM to all processes
+ when terminating. We don't want erl_child_setup to terminate
+ in these cases as that will prevent beam from properly
+ cleaning up.
+ */
+ sa.sa_handler = SIG_IGN;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+
+ if (sigaction(SIGTERM, &sa, 0) == -1) {
+ perror(NULL);
+ exit(1);
+ }
+
forker_hash_init();
SET_CLOEXEC(uds_fd);