Bug 2084498

Summary: Active podman process blocks system reboot/shutdown
Product: [Fedora] Fedora Reporter: Stephane Travostino <steph>
Component: podmanAssignee: Matthew Heon <mheon>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 36CC: acui, bbaude, container-sig, debarshir, dwalsh, jnovy, lsm5, mheon, patrick, pehunt, rh.container.bot, santiago, vrothber
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: podman-4.4.1-3.fc36 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-02-25 04:00:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Stephane Travostino 2022-05-12 09:52:38 UTC
Description of problem:

An active podman process is unable to be cleanly stopped by systemd reboot/shutdown, and thus has to be killed after the 2min grace period expires.

How reproducible:

Always.

Steps to Reproduce:
1. `podman run -it docker.io/library/busybox`
2. Inside the container: `sleep infinity`
3. Reboot the system

Actual results:

Shutdown procedure hangs for ~2 minutes because podman can't be stopped. Then podman is killed and shutdown is complete.

Expected results:

Podman is terminated gracefully like any other process and system reboots immediately.

Additional info:

Related toolbox bug, caused by this one: https://bugzilla.redhat.com/show_bug.cgi?id=2081664

Comment 1 Stephane Travostino 2022-06-08 12:51:21 UTC
Upstream issue: https://github.com/containers/podman/issues/14531

Comment 2 Valentin Rothberg 2022-06-08 12:58:26 UTC
Quoting from the upstream comment [1]:

I don't think there is much Podman can do. sleep in busybox does not seem to respond to SIGSTOP, so systemd has to wait for the grace period to end until it can kill the process.

[1] https://github.com/containers/podman/issues/14531#issuecomment-1149879040

Comment 3 Daniel Walsh 2022-06-08 13:52:50 UTC
I believe that podman run/start should catch SIGTERM and then execute podman stop on its pods/containers. This would cause the containers to exit properly or exit after 10 seconds.
This might be a slight deviation from Docker in some corner cases, but I believe this is the right behaviour. Especially if a container is running with a STOP_SIGNAL that is different
then SIG_TERM.  In the common case where a container is sending SIG_TERM, there is no change except the container gets killed after 10 seconds.  In the case where STOP_SIGNAL is set
then the container has a chance to close cleanly (systemd based containers for example). 
The only case that really changes is a corner case where user expects SIGTERM of Podman to send SIGTERM to container, when the container is not useing STOP_SIGNAL==SIGTERM.  In this case
users could just call `podman kill --signal SIGTERM $CTR`

From a user point of view, I think this is the most user friendly way to handle this.

Comment 4 Debarshi Ray 2023-02-13 20:06:35 UTC
I think this was fixed upstream:
https://github.com/containers/podman/issues/14531
https://github.com/containers/podman/pull/17025

Comment 5 Fedora Update System 2023-02-15 13:53:38 UTC
FEDORA-2023-431945fc20 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2023-431945fc20

Comment 6 Fedora Update System 2023-02-18 02:21:28 UTC
FEDORA-2023-998dbd3b79 has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-998dbd3b79`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-998dbd3b79

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2023-02-25 04:00:54 UTC
FEDORA-2023-998dbd3b79 has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.