-
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
Fix: Prevent OCI runtime directory remain #14720
Conversation
This bug was introduced in containers#8906. When we use 'podman rm/restart/stop/kill etc...' command to the container running with --rm, the OCI runtime directory remains at /run/<runtime name> (root user) or /run/user/<user id>/<runtime name> (rootless user). This bug could cause other bugs. For example, when we checkpoint the container running with --rm (podman checkpoint --export) and restore it (podman restore --import) with crun, error message "Error: OCI runtime error: crun: container `<container id>` already exists" is outputted. This error is caused by an attempt to restore the container with the same container ID as the remaining OCI runtime's container ID. Therefore, I fix that the cleanupRuntime() function runs to remove the OCI runtime directory, even if the container has already been removed by --rm option. Signed-off-by: Toshiki Sonoda <[email protected]>
I would expect that the cleanup process which removes containers started with |
@mheon I think there are two plans to remove the OCI runtime directory with
The 1st plan needs to change the container state from The 2nd plan needs to change the container state to If we choose the 1st plan, we need to deal with the warning message. I think the 2nd plan is better because it does not output warnings |
The logic behind cleanup is correct; we absolutely should not attempt to clean up Stopping containers, as they are still running. The problem is that, somehow, the state transition from Stopping to Stopped is not detected (from what you've said, seemingly only in the Of these, 2 presently seems more likely. It seems that https://github.com/containers/podman/blob/main/libpod/runtime_ctr.go#L701 should also trigger for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan, sstosh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This bug was introduced in #8906.
When we use
podman rm/restart/stop/kill etc...
command tothe container running with
--rm
, the OCI runtime directoryremains at
/run/<runtime name>
(root user) or/run/user/<user id>/<runtime name>
(rootless user).This bug could cause other bugs.
For example, when we checkpoint the container running with
--rm
(podman checkpoint --export) and restore it(podman restore --import) with crun, error message
Error: OCI runtime error: crun: container '<container id>' already exists
is outputted.This error is caused by an attempt to restore the container with
the same container ID as the remaining OCI runtime's container ID.
Therefore, I fix that the
cleanupRuntime()
function runs toremove the OCI runtime directory,
even if the container has already been removed by
--rm
option.Signed-off-by: Toshiki Sonoda [email protected]
Does this PR introduce a user-facing change?