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

kill: wait for the container #16177

Merged
merged 1 commit into from
Oct 14, 2022

Conversation

vrothberg
Copy link
Member

@vrothberg vrothberg commented Oct 14, 2022

Make sure to wait for the container to exit after kill. While the cleanup process will take care eventually of transitioning the state, we need to give a guarantee to the user to leave the container in the expected state once the (kill) command has finished.

The issue could be observed in a flaking test (#16142) where podman rm -f -t0 failed because the preceding podman kill left the container in "running" state which ultimately confused the "stop" backend.

Note that we should only wait for the container to exit when SIGKILL is being used. Other signals have different semantics.

[NO NEW TESTS NEEDED] as I do not know how to reliably reproduce the issue. If #16142 stops flaking, we are good.

Fixes: #16142
Signed-off-by: Valentin Rothberg [email protected]

Does this PR introduce a user-facing change?

Fix a bug where `podman kill` would not transition the container to the exited state.

@vrothberg
Copy link
Member Author

@mheon PTAL

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 14, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vrothberg

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 Oct 14, 2022
Make sure to wait for the container to exit after kill. While the
cleanup process will take care eventually of transitioning the state, we
need to give a guarantee to the user to leave the container in the
expected state once the (kill) command has finished.

The issue could be observed in a flaking test (containers#16142) where
`podman rm -f -t0` failed because the preceding `podman kill`
left the container in "running" state which ultimately confused
the "stop" backend.

Note that we should only wait for the container to exit when SIGKILL is
being used.  Other signals have different semantics.

[NO NEW TESTS NEEDED] as I do not know how to reliably reproduce the
issue.  If containers#16142 stops flaking, we are good.

Fixes: containers#16142
Signed-off-by: Valentin Rothberg <[email protected]>
@@ -82,6 +82,7 @@ var _ = Describe("Podman attach", func() {
Expect(results.OutputToString()).To(ContainSubstring("test"))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
})

Copy link
Member

Choose a reason for hiding this comment

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

You could have cheated on the test checker. :^)

Copy link
Member Author

Choose a reason for hiding this comment

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

:-D this came from looking at test failures

@rhatdan
Copy link
Member

rhatdan commented Oct 14, 2022

LGTM
@edsantiago @baude PTAL

@mheon
Copy link
Member

mheon commented Oct 14, 2022

Doing this in Libpod feels a little wierd, but I can't construct a valid argument to not do it.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 14, 2022
@openshift-merge-robot openshift-merge-robot merged commit b712736 into containers:main Oct 14, 2022
@vrothberg vrothberg deleted the fix-16142 branch October 14, 2022 14:25
@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 Sep 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 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.

kill cpcontainer: could not be stopped... sending SIGKILL... container state improper
4 participants