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

cannot remove container: ... running or paused containers cannot be removed without force: container state improper #15783

Closed
edsantiago opened this issue Sep 13, 2022 · 8 comments · Fixed by #15794
Labels
flakes Flakes from Continuous Integration locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. remote Problem is in podman-remote

Comments

@edsantiago
Copy link
Member

New flake seen in remote f36-aarch64 root:

# podman-remote --url unix:/tmp/podman_tmp_nLiX run -d --log-driver=k8s-file quay.io/libpod/testimage:20220615 sh -c echo test1; echo test2
SHA
# podman-remote --url unix:/tmp/podman_tmp_nLiX logs --tail 1 SHA
test2
# podman-remote --url unix:/tmp/podman_tmp_nLiX restart SHA
SHA
# podman-remote --url unix:/tmp/podman_tmp_nLiX logs --tail 1 SHA
test2
# podman-remote --url unix:/tmp/podman_tmp_nLiX rm SHA
Error: cannot remove container SHA as it is running - running or paused containers cannot be removed without force: container state improper
[ rc=2 (** EXPECTED 0 **) ]

Not sure if this is a race in the test (missing podman wait?) or in podman-remote itself. Filing for later.

My flake logs shwo three instances, all remote, all aarch64.

[sys] 79 podman logs - tail test, k8s-file

@edsantiago edsantiago added flakes Flakes from Continuous Integration remote Problem is in podman-remote labels Sep 13, 2022
@github-actions github-actions bot removed the remote Problem is in podman-remote label Sep 13, 2022
@edsantiago edsantiago added the remote Problem is in podman-remote label Sep 13, 2022
@edsantiago
Copy link
Member Author

Different test, same symptom: f36-aarch64 again but not remote:

# podman info --format {{.Host.CgroupManager}}
systemd
# podman --cgroup-manager=cgroupfs run --name myc quay.io/libpod/testimage:20220615 true
# podman container inspect --format {{.HostConfig.CgroupManager}} myc
cgroupfs
# podman start myc
myc
# podman rm myc
Error: cannot remove container SHA as it is running - running or paused containers cannot be removed without force: container state improper
[ rc=2 (** EXPECTED 0 **) ]

This one does not look like a bug in the test, it actually looks like a bug-bug. podman start container-that-only-runs-true, followed by podman rm that-container, should never fail with "container is running".

@rhatdan
Copy link
Member

rhatdan commented Sep 13, 2022

@mheon This looks like we are waiting for podman container cleanup to change the state from running to complete?

@vrothberg
Copy link
Member

vrothberg commented Sep 14, 2022

Yes, that smells like a state-transition issue.

@Luap99
Copy link
Member

Luap99 commented Sep 14, 2022

That sounds like a test problem to me. podman start will only start the container process, there is absolutely zero guarantee that it will be finished by time we call podman rm, even if it is just true. After the container process finishes conmon needs to launch the podman container cleanup process.

The timing depends on the scheduler, I think the test assumption that this should work is wrong.

If you need a guarantee you either have to use podman wait or start the process in the foreground.

@vrothberg
Copy link
Member

vrothberg commented Sep 14, 2022

If you need a guarantee you either have to use podman wait or start the process in the foreground.

Isn't the test running the container in the foreground? There's no -d.

@edsantiago
Copy link
Member Author

I think the bug is missing -a in podman start. I'll open a PR to address that.

@Luap99
Copy link
Member

Luap99 commented Sep 14, 2022

# podman start myc
myc
# podman rm myc
Error: cannot remove container SHA as it is running - running or paused containers cannot be removed without force: container > state improper
[ rc=2 (** EXPECTED 0 **) ]

This one does not look like a bug in the test, it actually looks like a bug-bug. podman start container-that-only-runs-true, followed > by podman rm that-container, should never fail with "container is running".

And also in the original report you see podman restart and run -d

@vrothberg
Copy link
Member

Aaaah, nice catch, @Luap99! I somehow thought it was a run rm sequence.

edsantiago added a commit to edsantiago/libpod that referenced this issue Sep 14, 2022
Three tests were running 'container rm' on 'start'ed containers
that might not yet have exited. Fix. Also, tighten up the
tests themselves, to make even more sure that they test
what they're supposed to test.

Discovered, in CI, that 'podman-remote logs --timestamps'
was unimplemented. Thanks to @Luap99 for the fix to that.

Fixes: containers#15783
Fixes: containers#15795

Signed-off-by: Ed Santiago <[email protected]>
@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 15, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
flakes Flakes from Continuous Integration locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. remote Problem is in podman-remote
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants