Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37601319
en ru br
Репозитории ALT
S:25.3-alt1
D:R12B.3-alt0.7
5.1: R12B.5-alt11.1
4.1: R11B.5-alt1
4.0: R11B.5-alt1
3.0: R10B.0-alt1
+backports:R10B.10-alt0.M30.1
www.altlinux.org/Changes

Другие репозитории
Upstream:12.B.1

Группа :: Development/Erlang
Пакет: erlang

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: alt-erlang-systemd.patch
Скачать


rom 18fc1239e3b5db5bd23bef6524550bc433d4730b Mon Sep 17 00:00:00 2001
From: Alexey Lebedeff <alebedev@mirantis.com>
Date: Tue, 29 Mar 2016 20:30:22 +0300
Subject: [PATCH 1/1] 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 ++++--
 erts/epmd/src/epmd_srv.c |    8 +++++---
 2 files changed, 9 insertions(+), 5 deletions(-)
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");
-- 
1.7.3.3
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin