From cff8dce026edfa86d0c96aebfbb8af53fee238a6 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Fri, 16 Feb 2018 09:55:08 +0100 Subject: erts: Ignore SIGTERM in erl_child_setup --- erts/emulator/sys/unix/erl_child_setup.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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); -- cgit v1.2.3