mirror of
https://github.com/troglobit/finit.git
synced 2026-10-31 13:00:32 +00:00
Clear pid condition on service collection to fix stale deps
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 <pid/mgmtd> ← zebra <!pid/netd> ← staticd <!pid/zebra> 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 <troglobit@gmail.com>
This commit is contained in:
1 file changed
+13
@@ -1093,6 +1093,7 @@ static void service_notify_stop(svc_t *svc)
|
|||||||
*/
|
*/
|
||||||
static void service_cleanup(svc_t *svc)
|
static void service_cleanup(svc_t *svc)
|
||||||
{
|
{
|
||||||
|
char cond[MAX_COND_LEN];
|
||||||
char *fn;
|
char *fn;
|
||||||
|
|
||||||
/* PID collected, cancel any pending SIGKILL */
|
/* 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",
|
logit(LOG_CRIT, "Failed removing service %s pidfile %s",
|
||||||
svc_ident(svc, NULL, 0), fn);
|
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);
|
service_notify_stop(svc);
|
||||||
|
|
||||||
/* No longer running, update books. */
|
/* No longer running, update books. */
|
||||||
|
|||||||
Reference in new issue
Block a user