]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/core/service.c
core: really skip automatic restart when a JOB_STOP job is pending
authorFranck Bui <fbui@suse.com>
Fri, 18 Feb 2022 09:06:24 +0000 (10:06 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 22 Feb 2022 10:45:12 +0000 (11:45 +0100)
commitc972880640ee19e89ce9265d8eae1b3aae190332
tree7b490d7c04e18716bc7be976b3b90bac43446ba5
parent6d7127d6dd0f3cfdf94d942f33ea9c3a783d887f
core: really skip automatic restart when a JOB_STOP job is pending

It's not clear why we rescheduled a service auto restart while a stop job for
the unit was pending. The comment claims that the unit shouldn't be restarted
but the code did reschedule an auto restart meanwhile.

In practice that was rarely an issue because the service waited for the next
auto restart to be rescheduled, letting the queued stop job to be proceed and
service_stop() to be called preventing the next restart to complete.

However when RestartSec=0, the timer expired right away making PID1 to
reschedule the unit again, making the timer expired right away... and so
on. This busy loop prevented PID1 to handle any queued jobs (and hence giving
no chance to the start rate limiting to trigger), which made the busy loop last
forever.

This patch breaks this loop by skipping the reschedule of the unit auto restart
and hence not depending on the value of u->restart_usec anymore.

Fixes: #13667
src/core/service.c