[SSSD] [PATCH] Monitor: read the correct SIGKILL timeout for providers, too

Jakub Hrozek jhrozek at redhat.com
Wed Oct 24 20:18:30 UTC 2012


We only read the configured SIGKILL time for services and actually used
the value of 0, which actually translated into
tevent_schedule_immediate. That meant that after we sent the SIGTERM we
also sent a SIGKILL right away, which is bad...
-------------- next part --------------
>From 2d735cd91f53e250247e04e72599ce5d1d492c7e Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Wed, 24 Oct 2012 15:54:08 -0400
Subject: [PATCH] Monitor: read the correct SIGKILL timeout for providers, too

https://fedorahosted.org/sssd/ticket/1602
---
 src/monitor/monitor.c | 69 +++++++++++++++++++++++++++------------------------
 1 file changed, 36 insertions(+), 33 deletions(-)

diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index a5653999e7531e27556693f88d1d988cc6c24a59..2148f4e06a7a2c4154c919ebc4583c4798599850 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -884,6 +884,37 @@ int get_monitor_config(struct mt_ctx *ctx)
     return EOK;
 }
 
+static errno_t get_ping_config(struct mt_ctx *ctx, const char *path,
+                               struct mt_svc *svc)
+{
+    errno_t ret;
+
+    ret = confdb_get_int(ctx->cdb, path,
+                         CONFDB_DOMAIN_TIMEOUT,
+                         MONITOR_DEF_PING_TIME, &svc->ping_time);
+    if (ret != EOK) {
+        DEBUG(SSSDBG_CRIT_FAILURE,
+               ("Failed to start service '%s'\n", svc->name));
+        return ret;
+    }
+
+    /* 'timeout = 0' should be translated to the default */
+    if (svc->ping_time == 0) {
+        svc->ping_time = MONITOR_DEF_PING_TIME;
+    }
+
+    ret = confdb_get_int(ctx->cdb, path,
+                         CONFDB_SERVICE_FORCE_TIMEOUT,
+                         MONITOR_DEF_FORCE_TIME, &svc->kill_time);
+    if (ret != EOK) {
+        DEBUG(SSSDBG_CRIT_FAILURE,
+              ("Failed to get kill timeout for %s\n", svc->name));
+        return ret;
+    }
+
+    return EOK;
+}
+
 static int get_service_config(struct mt_ctx *ctx, const char *name,
                               struct mt_svc **svc_cfg)
 {
@@ -981,36 +1012,14 @@ static int get_service_config(struct mt_ctx *ctx, const char *name,
         }
     }
 
-    ret = confdb_get_int(ctx->cdb, path,
-                         CONFDB_SERVICE_TIMEOUT,
-                         MONITOR_DEF_PING_TIME, &svc->ping_time);
+    ret = get_ping_config(ctx, path, svc);
     if (ret != EOK) {
         DEBUG(SSSDBG_CRIT_FAILURE,
-              ("Failed to get ping timeout for %s\n", svc->name));
+              ("Failed to get ping timeouts for %s\n", svc->name));
         talloc_free(svc);
         return ret;
     }
 
-    /* 'timeout = 0' should be translated to the default */
-    if (svc->ping_time == 0) {
-        svc->ping_time = MONITOR_DEF_PING_TIME;
-    }
-
-    ret = confdb_get_int(ctx->cdb, path,
-                         CONFDB_SERVICE_FORCE_TIMEOUT,
-                         MONITOR_DEF_FORCE_TIME, &svc->kill_time);
-    if (ret != EOK) {
-        DEBUG(SSSDBG_CRIT_FAILURE,
-              ("Failed to get kill timeout for %s\n", svc->name));
-        talloc_free(svc);
-        return ret;
-    }
-
-    /* 'force_timeout = 0' should be translated to the default */
-    if (svc->kill_time == 0) {
-        svc->kill_time = MONITOR_DEF_FORCE_TIME;
-    }
-
     svc->last_restart = now;
 
     *svc_cfg = svc;
@@ -1096,20 +1105,14 @@ static int get_provider_config(struct mt_ctx *ctx, const char *name,
         return ret;
     }
 
-    ret = confdb_get_int(ctx->cdb, path,
-                         CONFDB_DOMAIN_TIMEOUT,
-                         MONITOR_DEF_PING_TIME, &svc->ping_time);
+    ret = get_ping_config(ctx, path, svc);
     if (ret != EOK) {
-        DEBUG(0,("Failed to start service '%s'\n", svc->name));
+        DEBUG(SSSDBG_CRIT_FAILURE,
+              ("Failed to get ping timeouts for %s\n", svc->name));
         talloc_free(svc);
         return ret;
     }
 
-    /* 'timeout = 0' should be translated to the default */
-    if (svc->ping_time == 0) {
-        svc->ping_time = MONITOR_DEF_PING_TIME;
-    }
-
     talloc_free(path);
 
     /* if no provider is present do not run the domain */
-- 
1.7.12.1



More information about the sssd-devel mailing list