Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Wrap stopping podman -t with systemd timeouts
Browse files Browse the repository at this point in the history
Currently with KillMode=none, if podman -t hangs, the command repeats
leaving the process and its cgroup around.
But if a stop/start command hangs, we should not start another one.

Instead time it out properly via TimeoutStopSec set to the 2x of
the timeout given to the managed podman action. Then if it expires,
kill its cgroup all the way (KillMode=control-group is a default)
before rerunning the same operation. Also note that using KilMode
process is not recommended by systemd man pages.

Increase the grace stop timeout defaults 10->42s to align it with:
containers/podman#8889

Closes-bug: #1945791
Change-Id: Iefe861f91cefe2a9cf773cae98b2440566ae8b5e
Signed-off-by: Bogdan Dobrelya <[email protected]>
  • Loading branch information
bogdando authored and sshnaidm committed Oct 13, 2021
1 parent 32834d0 commit badd5a3
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ ExecReload=/usr/bin/podman kill --signal {{ lookup('dict', container_data_unit).
{% if lookup('dict', container_data_unit).value.pre_stop_exec is defined %}
ExecStop=-/usr/bin/podman exec {{ lookup('dict', container_data_unit).key }} {{ lookup('dict', container_data_unit).value.pre_stop_exec }}
{% endif %}
ExecStop=/usr/bin/podman stop -t {{ lookup('dict', container_data_unit).value.stop_grace_period | default(10) | int }} {{ lookup('dict', container_data_unit).key }}
ExecStopPost=/usr/bin/podman stop -t {{ lookup('dict', container_data_unit).value.stop_grace_period | default(10) | int }} {{ lookup('dict', container_data_unit).key }}
ExecStop=/usr/bin/podman stop -t {{ lookup('dict', container_data_unit).value.stop_grace_period | default(42) | int }} {{ lookup('dict', container_data_unit).key }}
ExecStopPost=/usr/bin/podman stop -t {{ lookup('dict', container_data_unit).value.stop_grace_period | default(42) | int }} {{ lookup('dict', container_data_unit).key }}
SuccessExitStatus=137 142 143
KillMode=none
TimeoutStopSec={{ 2*lookup('dict', container_data_unit).value.stop_grace_period | default(42) | int }}
Type=forking
PIDFile=/run/{{ lookup('dict', container_data_unit).key }}.pid
{% if lookup('dict', container_data_unit).value.systemd_exec_flags is defined %}
Expand Down

0 comments on commit badd5a3

Please sign in to comment.