Hide Forgot
Description of problem: The manpage of `systemd.service` documents a behaviour of TimeoutStopSec that is in contradiction to what systemd actually does. Man page states: --- TimeoutStopSec= Configures the time to wait for stop. If a service is asked to stop, but does not terminate in the specified time, it will be terminated forcibly via SIGTERM, and after another timeout of equal duration with SIGKILL --- However the behaviour is - SIGTERM is sent immediately on `systemctl stop <service>` - if the service does no stop after TimeoutStopSec, SIGKILL is sent Version-Release number of selected component (if applicable): systemd-219-19.el7.x86_64 (RHEL-7.2) systemd-222-14.fc23.x86_64 (Fedora 23) How reproducible: 100% Steps to Reproduce: 1. Create a simple service that ignores SIGTERM ------ example.c ------ #include <stdio.h> #include <unistd.h> #include <signal.h> int main (int argc, char **argv) { signal(SIGTERM, SIG_IGN); sleep(300); } ------ end example.c ----- 2. Create a simple unit file ------ unit file ------ [Unit] Description=Test service for case 01576130 [Service] Type=simple ExecStart=/usr/local/bin/x TimeoutStopSec=20 ------ end unit file ---- 3. Start test service 4. Attach gdb to service 5. Stop the service 6. Observe the signals sent to the sample service. Actual results: Man page is incorrect (see description) Expected results: Man page documents the behaviour of systemd Additional info:
Uh, sorry it looks that we have overlooked this bug. It is not that simple, the manual message is in fact correct, there are really three steps, but since your service does not have ExecStop than we don't have anything to wait for, so we go to second step, which is sending sigterm.
https://github.com/systemd/systemd/issues/9325
https://github.com/systemd/systemd/pull/9378
https://github.com/lnykryn/systemd-rhel/pull/218
fix merged to staging branch -> https://github.com/lnykryn/systemd-rhel/pull/218 -> post
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2018:3245