diff --git a/erlang.spec b/erlang.spec index 4c830f3..16192d8 100644 --- a/erlang.spec +++ b/erlang.spec @@ -16,7 +16,7 @@ Name: erlang Version: 18.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: General-purpose programming language and runtime environment Group: Development/Languages @@ -72,6 +72,9 @@ Patch7: otp-0007-Split-off-webtool-dependency-from-tools.patch # Fedora specific patch # Add patch to crash dump on large distribution Patch8: otp-0008-Add-patch-to-crash-dump-on-large-distribution.patch +# Fedora specific patch +# Don't send unasked for systemd notifications +Patch9: otp-0009-Don-t-send-unasked-for-systemd-notifications.patch # end of autogenerated patch tag list BuildRequires: flex @@ -901,6 +904,7 @@ Erlang mode for XEmacs (source lisp files). %patch6 -p1 -b .Do_not_install_erlang_sources %patch7 -p1 -b .Split_off_webtool_dependency_from_tools %patch8 -p1 -b .Add_patch_to_crash_dump_on_large_distribution +%patch9 -p1 -b .Don_t_send_unasked_for_systemd_notifications # end of autogenerated prep patch list # FIXME we should come up with a better solution @@ -2226,6 +2230,10 @@ useradd -r -g epmd -d /tmp -s /sbin/nologin \ %changelog +* Thu Mar 31 2016 Peter Lemenkov - 18.3-2 +- Added patch to suppress sending systemd notifications from epmd if not + started as a systemd service. + * Thu Mar 24 2016 Peter Lemenkov - 18.3-1 - Ver. 18.3 diff --git a/otp-0009-Don-t-send-unasked-for-systemd-notifications.patch b/otp-0009-Don-t-send-unasked-for-systemd-notifications.patch new file mode 100644 index 0000000..1d19ace --- /dev/null +++ b/otp-0009-Don-t-send-unasked-for-systemd-notifications.patch @@ -0,0 +1,56 @@ +From: Alexey Lebedeff +Date: Tue, 29 Mar 2016 20:30:22 +0300 +Subject: [PATCH] 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. + +diff --git a/erts/epmd/src/epmd.c b/erts/epmd/src/epmd.c +index 5513cb2..4740ce8 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); + } +diff --git a/erts/epmd/src/epmd_srv.c b/erts/epmd/src/epmd_srv.c +index e1bac99..59d59ad 100644 +--- a/erts/epmd/src/epmd_srv.c ++++ b/erts/epmd/src/epmd_srv.c +@@ -452,9 +452,11 @@ void run(EpmdVars *g) + num_sockets = bound; + #ifdef HAVE_SYSTEMD_DAEMON + } +- sd_notifyf(0, "READY=1\n" +- "STATUS=Processing port mapping requests...\n" +- "MAINPID=%lu", (unsigned long) getpid()); ++ if (g->is_systemd) { ++ sd_notifyf(0, "READY=1\n" ++ "STATUS=Processing port mapping requests...\n" ++ "MAINPID=%lu", (unsigned long) getpid()); ++ } + #endif /* HAVE_SYSTEMD_DAEMON */ + + dbg_tty_printf(g,2,"entering the main select() loop");