URL: https://github.com/SSSD/sssd/pull/144
Author: fidencio
 Title: #144: SSSD does not start if using only the local provider and services 
line is empty
Action: synchronized

To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/144/head:pr144
git checkout pr144
From 0e86b768f7686d81f1b72dc26d6445ec68c96de6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <[email protected]>
Date: Sun, 5 Feb 2017 01:48:35 +0100
Subject: [PATCH 1/2] MONITOR: Wrap up sending sd_notify "ready" into a new
 function
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This new function will be used later on in this series as we also will
need to notify systemd that we're up in at least one more scenario (for
now).

Related:
https://fedorahosted.org/sssd/ticket/3299

Signed-off-by: Fabiano FidĂȘncio <[email protected]>
---
 src/monitor/monitor.c | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index b82c6e5..f55a89e 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -487,6 +487,26 @@ static void svc_child_info(struct mt_svc *svc, int wait_status)
     }
 }
 
+static int notify_startup(void)
+{
+#ifdef HAVE_SYSTEMD
+    int ret;
+
+    DEBUG(SSSDBG_TRACE_FUNC, "Sending startup notification to systemd\n");
+    ret = sd_notify(0, "READY=1");
+    if (ret < 0) {
+        ret = -ret;
+        DEBUG(SSSDBG_CRIT_FAILURE,
+                "Error sending notification to systemd %d: %s\n",
+                ret, sss_strerror(ret));
+
+       return ret;
+    }
+#endif
+
+    return EOK;
+}
+
 static int mark_service_as_started(struct mt_svc *svc)
 {
     struct mt_ctx *ctx = svc->mt_ctx;
@@ -557,15 +577,7 @@ static int mark_service_as_started(struct mt_svc *svc)
 
         ctx->pid_file_created = true;
 
-#ifdef HAVE_SYSTEMD
-        DEBUG(SSSDBG_TRACE_FUNC, "Sending startup notification to systemd\n");
-        ret = sd_notify(0, "READY=1");
-        if (ret < 0) {
-            DEBUG(SSSDBG_CRIT_FAILURE,
-                  "Error sending notification to systemd %d: %s\n",
-                  -ret, strerror(-ret));
-        }
-#endif
+        notify_startup();
 
         /* Initialization is complete, terminate parent process if in daemon
          * mode. Make sure we send the signal to the right process */

From 305bce7b3524ee35d3fcf21316cafaf021a44ebc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <[email protected]>
Date: Sun, 5 Feb 2017 01:55:56 +0100
Subject: [PATCH 2/2] MONITOR: Don't timeout if using local provider +
 socket-activated responders
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When using only the local provider with socket-activated services SSSD
ends up never notifying systemd its startup has been done, as notifying
systemd is done *only* when a service (provider or responder) is started
up, leading SSSD's startup to fail due to a timeout.

So, in order to avoid this situation, let's just notify the startup
earlier in case we have *only* socket-activated services and the *only*
provider set up is the LOCAL one.

Resolves:
https://fedorahosted.org/sssd/ticket/3299

Signed-off-by: Fabiano FidĂȘncio <[email protected]>
---
 src/monitor/monitor.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index f55a89e..1fa3d4b 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -2403,6 +2403,15 @@ static int monitor_process_init(struct mt_ctx *ctx,
         }
     }
 
+    /* When the only provider set up is the local one (num_providers == 0) and
+     * there's no responder explicitly set up it means that we should notify
+     * systemd that SSSD is ready right now as any other provider/responder
+     * would be able to do so and the SSSD would end up hitting a systemd
+     * timeout! */
+    if (num_providers == 0 && ctx->services == NULL) {
+        ret = notify_startup();
+    }
+
     return EOK;
 }
 
_______________________________________________
sssd-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to