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: opened
PR body: """ SSSD has to notify systemd whenever its startup is finished. Currently it has been done only when a service (and here I mean either provider or responder) has been started up. However, when dealing with socket-activation we have the case where no responders have been set up and, consequently, the sd_notify() code won't ever be triggered by the responders. Combining the above described scenario with the user setting up only the LOCAL provider, which also won't trigger the sd_notify() code, SSSD can end up hitting a systemd timeout during initialization. This patch set solve the described issue. """ 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 927e4b84ab0c364e6038944ceef67792fcb40666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fiden...@redhat.com> 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 <fiden...@redhat.com> --- src/monitor/monitor.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index b82c6e5..214ce34 100644 --- a/src/monitor/monitor.c +++ b/src/monitor/monitor.c @@ -487,6 +487,29 @@ 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)); + + goto done; + } + + ret = EOK; + +done: + return ret; +#endif +} + static int mark_service_as_started(struct mt_svc *svc) { struct mt_ctx *ctx = svc->mt_ctx; @@ -557,15 +580,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 23a2ca513707cd9d5f664abf89e3396d87ae3213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fiden...@redhat.com> 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 <fiden...@redhat.com> --- src/monitor/monitor.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index 214ce34..2883acb 100644 --- a/src/monitor/monitor.c +++ b/src/monitor/monitor.c @@ -2406,6 +2406,14 @@ static int monitor_process_init(struct mt_ctx *ctx, } } + /* num_providers == 0 means that the only provider set up + * is the local one. + * ctx->services == NULL means that there's no services + * set up ({dbus,socket}-activated case). */ + if (num_providers == 0 && ctx->services == NULL) { + ret = notify_startup(); + } + return EOK; }
_______________________________________________ sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org