From 40fc95047d69f0a6daba1350683c486f97059cdb Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Wed, 11 Oct 2017 23:52:29 +0200 Subject: [PATCH] Prevent 100% CPU, allow bootstrap tasks to fully complete When collecting a bootstrap task we need to allow its state machine to complete before cleaning them out. Signed-off-by: Joachim Nilsson --- src/service.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/service.c b/src/service.c index 54731c8f..bcc2f90f 100644 --- a/src/service.c +++ b/src/service.c @@ -718,11 +718,6 @@ void service_monitor(pid_t lost) return; } - if (svc_clean_bootstrap(svc)) { - _d("collected bootstrap task %s(%d), removing.", svc->cmd, lost); - goto done; - } - _d("collected %s(%d)", svc->cmd, lost); /* Try removing PID file (in case service does not clean up after itself) */ @@ -736,7 +731,10 @@ void service_monitor(pid_t lost) svc->pid = 0; service_step(svc); -done: + /* Clean out any bootstrap tasks, they've had their time in the sun. */ + if (svc_clean_bootstrap(svc)) + _d("collected bootstrap task %s(%d), removing.", svc->cmd, lost); + sm_step(&sm); }