From 1fbf03bc1e979e909e4f781d06fe285682def535 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Thu, 12 Feb 2026 07:50:28 +0100 Subject: [PATCH] Clear pid condition on service collection to fix stale deps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In a setup like this, when 'netd' is marked dirty and subsequently is reloaded, e.g., using 'initctl reload', zebra is properly restarted, but staticd isn't: mgmtd ← netd ← zebra ← staticd Finit must invalidate the condition of zebra to trigger a restart also of staticd. This to guard against daemons like zebra that may fail to clean up their pidfiles. Fixes #475 Signed-off-by: Joachim Wiberg --- src/service.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/service.c b/src/service.c index 05121d06..eefae25b 100644 --- a/src/service.c +++ b/src/service.c @@ -1093,6 +1093,7 @@ static void service_notify_stop(svc_t *svc) */ static void service_cleanup(svc_t *svc) { + char cond[MAX_COND_LEN]; char *fn; /* PID collected, cancel any pending SIGKILL */ @@ -1103,6 +1104,18 @@ static void service_cleanup(svc_t *svc) logit(LOG_CRIT, "Failed removing service %s pidfile %s", svc_ident(svc, NULL, 0), fn); + /* + * Invalidate the pid/ condition for this service to ensure + * dependent services are properly stopped and restarted. + * Without this, the condition is only cleared asynchronously + * via inotify on pidfile removal, which may not trigger when + * the daemon fails to clean up its own pidfile, or when the + * service dies during a reload cycle and goes directly from + * RUNNING to HALTED (skipping STOPPING where cond_clear() + * is normally called). + */ + cond_clear(mkcond(svc, cond, sizeof(cond))); + service_notify_stop(svc); /* No longer running, update books. */