Skip to content

Commit 50b9e46

Browse files
authored
Merge pull request #484 from finit-project/rdep-stop-cond
Clear condition before stopping rdeps on reload
2 parents 4867b72 + c01faef commit 50b9e46

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/service.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2418,7 +2418,21 @@ void service_update_rdeps(void)
24182418
if (!svc_is_noreload(svc))
24192419
continue; /* Yup, no need to stop start rdeps */
24202420

2421-
svc_mark_affected(mkcond(svc, cond, sizeof(cond)));
2421+
/*
2422+
* Clear the condition immediately, before service_step_all()
2423+
* runs. cond_clear() calls cond_update() which calls
2424+
* service_step() on all affected services right now. Those
2425+
* services see COND_OFF and get service_stop() called,
2426+
* transitioning to STOPPING_STATE before we ever send SIGTERM
2427+
* to this service. Without this, the condition is only cleared
2428+
* after the service dies, by which time reverse-dependencies
2429+
* may have already crashed due to the lost connection.
2430+
* See also: api.c do_reload() which does the same for direct
2431+
* 'initctl reload <svc>' calls.
2432+
*/
2433+
mkcond(svc, cond, sizeof(cond));
2434+
cond_clear(cond);
2435+
svc_mark_affected(cond);
24222436
}
24232437
}
24242438

0 commit comments

Comments
 (0)