Be more aggressive with stopping services
What does this Merge Request do and why?
This MR aims to be more aggressive when it comes to stopping services when gdk stop
is executed to ensure we don't have any zombie processes lying around.
When running gdk stop
, for each service runit
would execute sv/<service>/control/t
which would:
Before
- Kill off the PID group (
-<PID>
) by sending the-TERM
(-15
) signal =>kill -TERM -<PID>
- Kill off the PID (
<PID>
) by sending the-TERM
(-15
) signal =>kill -TERM <PID>
For the webpack
service however, we'd send -KILL
(-9
) explicitly, instead of -TERM
(-15
).
Now
- Kill off the PID group (
-<PID>
) by sending the-TERM
(-15
) signal =>kill -TERM -<PID>
- Kill off the PID (
<PID>
) by sending the-TERM
(-15
) signal =>kill -TERM <PID>
- Give the PID up to 3 secs to die off on its own and:
- If PID dead:
- Exit with
0
- Exit with
- If PID not dead:
- Kill off the PID group (
-<PID>
) by sending the-KILL
(-9
) signal -kill -KILL -<PID>
- Kill off the PID (
<PID>
) by sending the-KILL
(-9
) signal -kill -KILL <PID>
- Kill off the PID group (
- If PID dead:
Unfortunately after lots of experimentation, webpack
still needs to be sent the KILL
signal initially, otherwise it goes zombie
Merge Request checklist
-
This change is backward compatible. If not, please include steps to communicate to our users. -
Tests added for new functionality. If not, please raise Issue to follow-up. -
Documentation added/updated, if needed. -
gdk doctor
test added, if needed. -
Add the ~highlight
label if this MR should be included in theCHANGELOG.md
.
Edited by Ash McKenzie