From 16b921ad1c847ba0754adc10d2d45b17973dcd19 Mon Sep 17 00:00:00 2001 From: Alexey Lebedeff Date: Tue, 29 Mar 2016 20:30:22 +0300 Subject: Don't send unasked for systemd notifications Suppose we have some erlang system that uses systemd unit with Type=notify - so this should send startup confirmation itself. But if systemd-enabled epmd will be started as a first step of that system startup, empd startup confirmation will be misinterpeted by systemd. And our erlang service will be considered 'ready' to early. Also this will interefere with systemd MAINPID detection: systemd will be monitoring `epmd` process instead of `beam` one. For example, rabbitmq works around this issue by starting epmd using separate short-lived beam process, with NOTIFY_SOCKET environment variable reset - only in this way we could be sure that epmd will not interfere with rabbit startup sequence. This patch disables indiscriminate confirmation sending, and does it only when it was explicitly asked to do so. --- erts/epmd/src/epmd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'erts/epmd/src/epmd.c') diff --git a/erts/epmd/src/epmd.c b/erts/epmd/src/epmd.c index 5513cb2d7e..4740ce8534 100644 --- a/erts/epmd/src/epmd.c +++ b/erts/epmd/src/epmd.c @@ -592,8 +592,10 @@ void epmd_cleanup_exit(EpmdVars *g, int exitval) free(g->argv); } #ifdef HAVE_SYSTEMD_DAEMON - sd_notifyf(0, "STATUS=Exited.\n" - "ERRNO=%i", exitval); + if (g->is_systemd){ + sd_notifyf(0, "STATUS=Exited.\n" + "ERRNO=%i", exitval); + } #endif /* HAVE_SYSTEMD_DAEMON */ exit(exitval); } -- cgit v1.2.3