From 97c31cbd8ece0fed037503fae30361f722154249 Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Fri, 18 Oct 2024 09:04:07 -0700 Subject: [PATCH] rfc15: describe flux imp run signal handling Problem: the RFC does not describe how processes started by flux-imp run would be signaled. Linger and forward signals in the same manner as the IMP does for the shell, except never try to signal the cgroup. Add a note about running these tasks under systemd with its enhanced cleanup capability. --- spec_15.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/spec_15.rst b/spec_15.rst index 43daec7..a014cd0 100644 --- a/spec_15.rst +++ b/spec_15.rst @@ -372,6 +372,8 @@ A multi-user instance of Flux not only requires the ability to execute work as a guest user, but it must also have privilege to monitor and kill these processes as part of normal resource manager operation. +.. _signal_handling: + Signal Handling --------------- @@ -429,6 +431,25 @@ allowed-environment passed through to the executable. By default, only :envvar:`FLUX_JOB_ID` and :envvar:`FLUX_JOB_USERID` SHALL pass through. +To enable the instance owner to implement execution timeouts, the IMP SHALL +linger while these commands execute and act as a signal proxy by trapping +common signals and forwarding them to the direct child, with SIGUSR1 acting as +a surrogate for SIGKILL as described in :ref:`signal_handling`. + +.. note:: + + Flux MAY be configured to run prolog, epilog, and housekeeping scripts + as one-shot systemd services, which enables them to persist across a Flux + restart and run in a dedicated cgroup. + + This is accomplished by configuring Flux-provided wrapper scripts as the + administrative executable. The wrapper scripts trap SIGTERM and run + :program:`systemctl stop`, which tells systemd to terminate [#f2]_ all + processes in the unit's cgroup. + + SIGKILL SHOULD be avoided in this configuration as it would only terminate + the wrapper script, not the systemd unit + IMP configuration ================= @@ -461,3 +482,5 @@ References ********** .. [#f1] `Preventing Privilege Escalation `__, Niels Provos, Markus Friedl, Peter Honeyman. + +.. [#f2] `systemd.kill(5) `__ KillMode.