-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Processes started by podman exec may continue to run after podman exec terminates #19486
Comments
Thanks for opening and the issue along with the reproducer, @hmkemppainen ! I am surprised this doesn't work but did not take a look at the code. Cc: @mheon |
The So this is basically what I'd expect. We do have additional primitives exposed via API for dealing with exec sessions, including the ability to kill running sessions, but we don't expose those via CLI, only the Docker-compat API. |
A friendly reminder that this issue had no activity for 30 days. |
Does podman exec handle SIGTERM in this case? IE does it kill the exec session? |
No, we don't sig-proxy for exec. |
That is unexpected from the User, At least this user. |
Would you expect that SIGTERM would kill the whole exec session or just PID1? |
Well, the first PID of the exec session, not PID1 |
Yes I think this would be the Human expectation. If I am running |
Issue Description
Processes started by
podman exec
(without--detach
) may be left running when the podman process is terminated.I don't know if this is a bug or a feature, but it can make it very difficult for the parent process to correctly manage its children and this can lead to annoying failure modes.
Steps to reproduce the issue
Steps to reproduce the issue:
use
podman run
to start a container running netcat:$ podman run --rm -i alpine nc -vnlkp 1234
use
podman exec
to start another netcat, connecting to the first one:$ podman exec -l -i nc -vn 127.0.0.1 1234
verify that you have four related processes:
kill the
podman exec
process:$ pkill -f podman\ exec
observe that
podman exec
is gone but the netcat is still running (and remains connected to the 1st netcat!)Describe the results you received
The process started under podman exec is still running, even though the podman process itself is gone.
This behavior will confuse parent processes that aren't nearly as interested in the lifetime of the podman glue as they are in the actual process they are trying to run inside the container. The usual way of killing or checking whether the interesting process is still alive doesn't work. Also using setsid() after fork & before execing podman and killing the process group doesn't kill the child, because it lives in yet another session.
Describe the results you expected
The child process should die along with podman exec.
podman info output
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
No
Additional environment details
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: