TECHNOLOGY

KillMode=mixed uses different process targets for graceful and final signals

In this article
THE QUICK TAKE

The systemd kill manual describes mixed as sending the initial termination signal to the main process and the final kill signal to remaining processes in the unit control group. With defaults these are SIGTERM and SIGKILL. The final phase can follow the main process exiting, or the stop timeout expiring. It is therefore incorrect to assume children necessarily keep running until TimeoutStopSec after a coordinator has already exited.

A multiprocess inference service may rely on its coordinator to drain requests and stop children in order. KillMode=mixed supports a particular signal distribution, but it does not give every worker the full shutdown interval. Confusing its graceful target with its final target can leave a shutdown design depending on time the children never receive.

The service-manager contract

The systemd kill manual describes mixed as sending the initial termination signal to the main process and the final kill signal to remaining processes in the unit control group. With defaults these are SIGTERM and SIGKILL. The final phase can follow the main process exiting, or the stop timeout expiring. It is therefore incorrect to assume children necessarily keep running until TimeoutStopSec after a coordinator has already exited.

Implementation details

Document how the application identifies its main process and how that process asks children to drain. Keep it alive until the required acknowledgements are collected if the design depends on their graceful completion. Inspect KillSignal, RestartKillSignal, FinalKillSignal and SendSIGKILL alongside KillMode; altered settings change the effective behavior. The default control-group mode has a different initial signal scope. Do not infer mixed semantics from a test performed with that default.

A constructed validation case

Build a coordinator and child fixture that records signal receipt, drain acknowledgement and process exit without storing request content. In one branch the coordinator waits for the child to finish; in another it exits immediately after receiving termination. Compare remaining-child lifetime and final signal delivery. Add a child that ignores the drain request and a branch that reaches the configured stop deadline. The acceptance question is whether the observed recipients match the intended lifecycle, not whether a dashboard eventually reports the unit inactive.

Recovery limits

Signal routing is not an application transaction boundary. An exited worker can still leave an incomplete response or an external operation whose result is unknown. Track those outcomes separately and test replacement readiness after stopping. Avoid changing to process or none merely to prolong children: the manual warns that those modes let processes escape normal service lifecycle management. A controlled test needs to account for effective privileges, wrappers and control-group membership.

Primary references

systemd systemd.kill documented interface; systemd systemd.service documented interface.

This is a proposed service-lifecycle validation, not an executed Retrivium benchmark. Preserve the implementation version and unresolved outcomes; interface documentation does not establish the availability or correctness of an inference service.

Graceful inference-server termination with active streams; Keep a service watchdog tied to useful progress.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles