URL: https://github.com/SSSD/sssd/pull/71
Author: jhrozek
 Title: #71: MONITOR: Do not set up watchdog for monitor
Action: opened

PR body:
"""
It makes little sense to set up watchdog for monitor because there is no
entity that would restart the monitor. Therefore we should disable the
watchdog for monitor process.

Resolves:
https://fedorahosted.org/sssd/ticket/3232
"""

To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/71/head:pr71
git checkout pr71
From 05cbdb2ce6f3e3f06d25959756a5f0fe4adabce0 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <[email protected]>
Date: Mon, 7 Nov 2016 11:58:20 +0100
Subject: [PATCH] MONITOR: Do not set up watchdog for monitor

It makes little sense to set up watchdog for monitor because there is no
entity that would restart the monitor. Therefore we should disable the
watchdog for monitor process.

Resolves:
https://fedorahosted.org/sssd/ticket/3232
---
 src/monitor/monitor.c |  2 ++
 src/util/server.c     | 11 +++++++----
 src/util/util.h       |  1 +
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 84a144e..935febb 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -2603,6 +2603,8 @@ int main(int argc, const char *argv[])
 
     /* we want a pid file check */
     flags |= FLAGS_PID_FILE;
+    /* the monitor should not run a watchdog on itself */
+    flags |= FLAGS_NO_WATCHDOG;
 
     /* Open before server_setup() does to have logging
      * during configuration checking */
diff --git a/src/util/server.c b/src/util/server.c
index 953cd3d..013e572 100644
--- a/src/util/server.c
+++ b/src/util/server.c
@@ -666,10 +666,13 @@ int server_setup(const char *name, int flags,
                                      ret, strerror(ret));
         return ret;
     }
-    ret = setup_watchdog(ctx->event_ctx, watchdog_interval);
-    if (ret != EOK) {
-        DEBUG(SSSDBG_CRIT_FAILURE, "Watchdog setup failed.\n");
-        return ret;
+
+    if ((flags & FLAGS_NO_WATCHDOG) == 0) {
+        ret = setup_watchdog(ctx->event_ctx, watchdog_interval);
+        if (ret != EOK) {
+            DEBUG(SSSDBG_CRIT_FAILURE, "Watchdog setup failed.\n");
+            return ret;
+        }
     }
 
     sss_log(SSS_LOG_INFO, "Starting up");
diff --git a/src/util/util.h b/src/util/util.h
index 9c39a5c..4bfccfa 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -88,6 +88,7 @@
 #define FLAGS_INTERACTIVE 0x0002
 #define FLAGS_PID_FILE 0x0004
 #define FLAGS_GEN_CONF 0x0008
+#define FLAGS_NO_WATCHDOG 0x0010
 
 #define PIPE_INIT { -1, -1 }
 
_______________________________________________
sssd-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to