mirror of
https://github.com/troglobit/finit.git
synced 2026-10-10 16:52:39 +07:00
When collecting a script or unregistering a service, cancel timeouts
Both service and sysv stanzas support a cleanup:script (since v4.10), with an optional timeout. These timers must be stopped when collecting a PID for an svc_t, or when unregistering an svc_t, otherwise the timer callback will be continuously called, reporting "spurious problem", and cause 100% CPU usage. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -2098,6 +2098,7 @@ void service_unregister(svc_t *svc)
|
||||
return;
|
||||
|
||||
service_stop(svc);
|
||||
service_timeout_cancel(svc);
|
||||
|
||||
for (c = strtok(svc->cond, ","); c; c = strtok(NULL, ","))
|
||||
devmon_del_cond(c);
|
||||
@@ -2137,6 +2138,10 @@ void service_monitor(pid_t lost, int status)
|
||||
: (svc->state == SVC_CLEANUP_STATE
|
||||
? svc->cleanup_script
|
||||
: svc->pre_script)), lost, ok, sig, rc);
|
||||
|
||||
/* Prevent: spurious problem from timeout callback */
|
||||
service_timeout_cancel(svc);
|
||||
|
||||
/* Kill all children in the same proess group, e.g. logit */
|
||||
dbg("Killing lingering children in same process group ...");
|
||||
kill(-svc->pid, SIGKILL);
|
||||
|
||||
Reference in New Issue
Block a user