mirror of
https://github.com/troglobit/finit.git
synced 2026-11-07 16:01:08 +00: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:
1 file changed
+5
@@ -2098,6 +2098,7 @@ void service_unregister(svc_t *svc)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
service_stop(svc);
|
service_stop(svc);
|
||||||
|
service_timeout_cancel(svc);
|
||||||
|
|
||||||
for (c = strtok(svc->cond, ","); c; c = strtok(NULL, ","))
|
for (c = strtok(svc->cond, ","); c; c = strtok(NULL, ","))
|
||||||
devmon_del_cond(c);
|
devmon_del_cond(c);
|
||||||
@@ -2137,6 +2138,10 @@ void service_monitor(pid_t lost, int status)
|
|||||||
: (svc->state == SVC_CLEANUP_STATE
|
: (svc->state == SVC_CLEANUP_STATE
|
||||||
? svc->cleanup_script
|
? svc->cleanup_script
|
||||||
: svc->pre_script)), lost, ok, sig, rc);
|
: 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 */
|
/* Kill all children in the same proess group, e.g. logit */
|
||||||
dbg("Killing lingering children in same process group ...");
|
dbg("Killing lingering children in same process group ...");
|
||||||
kill(-svc->pid, SIGKILL);
|
kill(-svc->pid, SIGKILL);
|
||||||
|
|||||||
Reference in new issue
Block a user