Skip to content
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

libpod: do not Cleanup() more than once #18462

Merged
merged 1 commit into from
May 4, 2023

Conversation

Luap99
Copy link
Member

@Luap99 Luap99 commented May 4, 2023

If the container was already cleaned up we should not try to do it again. Podman stop will always try to call Cleanup() if you look at the podman event log and just keep calling podman stop --all you see a cleanup event every time. This is not wanted. Also in case of the host pidns we report a error every single time, see the linked issue.

Fixes #18460

Does this PR introduce a user-facing change?

Containers created with --pid=host will no longer print errors on podman stop.

If the container was already cleaned up we should not try to do it
again. Podman stop will always try to call Cleanup() if you look at the
podman event log and just keep calling podman stop --all you see a
cleanup event every time. This is not wanted. Also in case of the host
pidns we report a error every single time, see the linked issue.

Fixes containers#18460

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
@openshift-ci
Copy link
Contributor

openshift-ci bot commented May 4, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Luap99

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 4, 2023
@Luap99
Copy link
Member Author

Luap99 commented May 4, 2023

@mheon @vrothberg PTAL

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the test nit
LGTM

@@ -126,6 +126,12 @@ var _ = Describe("Podman stop", func() {
finalCtrs.WaitWithDefaultTimeout()
Expect(finalCtrs).Should(Exit(0))
Expect(strings.TrimSpace(finalCtrs.OutputToString())).To(Equal(""))

// make sure we only have one cleanup event for this container
events := podmanTest.Podman([]string{"events", "--since=30s", "--stream=false"})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance we use a timestamp created at the beginning of the test?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could but each test uses their own event file so it shouldn't matter.

@mheon
Copy link
Member

mheon commented May 4, 2023

Sure, LGTM.

I have vague concerns that we could somehow get a container in Exited that still had a network namespace associated with it through a cleanup failure, but even in this worst-case the only end result is a small resource leak that should fix itself on restarting the container.

I'll hold off on a hold/lgtm until @vrothberg confirms that the tests are good.

@vrothberg
Copy link
Member

/lgtm
/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 4, 2023
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 4, 2023
@Luap99
Copy link
Member Author

Luap99 commented May 4, 2023

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 4, 2023
@openshift-merge-robot openshift-merge-robot merged commit 8bfb27a into containers:main May 4, 2023
@Luap99 Luap99 deleted the no-cleanup-twice branch May 4, 2023 13:55
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Aug 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--pid host causes podman stop to print oci runtime errors when the container is already stopped
4 participants