-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Impossible to recreate a container with the same name that a container already removed #2240
Comments
Does the original container actually exists? |
Try a |
There could be a race condition here. Where one container is exiting, and running podman cleanup while another container is launching, |
I have already try |
Just to be sure, did you try |
Yep see the bug description |
I have try the following commands to find an existing container with the same name and no results was founds: $ sudo podman ps
$ # no results found
$ sudo podman ps -a
$ # no results found
$ sudo podman volume list
$ # no results found and no volumes exists |
Volumes don't share names with pods and containers, so Can you try |
@mheon I'm sorry but I'm not sure to can reproduce this issue all the time (a little bit random) and I have already reset my env... If I'm facing it again lets me append my traceback and outputs commands here, especially |
If you do manage to reproduce again, and the pod check produces negative, also append |
There's a small chance we have some sort of state corruption going on, but I would think we would have hit this before if so. |
I attempted something this But nothing failed. |
If I reproduce again I will push all the informations to this issue |
FWIW when I was looking at this with Herve I did try a 'podman pod ps' and it returned empty. Hopefully we can collect /var/lib/containers/storage/libpod/bolt_state.db next time we hit this |
you can try the better reproducer version from #1656 (just drop the docker'ish part of it) |
Well.. I have successfully reproduce the problem...
|
I was able to get into this state also, but calling |
The containers seem to be remaining in c/storage, preventing us from creating new containers with the same names. Part of the problem seems to be c/storage not being durable enough under stress - it seems to start failing to delete containers a lot sooner than the rest of Podman. When it does, we still get rid of as much of the container as we can (rather than leave a half-configured container around), but the lingering c/storage container conflicts with new containers with the same name. We should look into why c/storage is failing here. I'm not sure if we have a good option for deleting the lingering storage containers... For all we know, they're valid |
@mheon interesting analyze |
I think we should add something to rm --removestorage, which would ignore the error from libpod saying the container does not exist, and remove the storage. |
@rhatdan Should we just recommend they use |
we call Buildah for building stuff, could we call rm too in error cases as a final hammer rather than telling the user to? |
The problem is, we've already called into c/storage in this case, and it's failed - I don't know if hammering it more by calling it again through Buildah would help... |
(We really ought to just drill into why c/storage is failing in these cases - it seems like making it more stable would be beneficial for all our tools) |
Are we sure that an error happened? or was this a race condition. |
@rhatdan Do you still have your reproducer? I'm expecting that we're getting errors out of c/storage, and we'd be printing them in that case |
I am not crazy about requiring buildah to be installed to get us out of a state where the container image was accidently left around. If I do a podman rm --force foobar, The user would expect the container to be removed and then be able to do We can add documentation to podman rm --force foobar indicating that this will remove not only podman containers named foobar but could remove containers created by other tools. |
I have merged in a fix for podman rm --force that will remove a container that libpod does not know about. This will get you our of this situation. |
The issue here seems to be some Podman command between the container being started, and the container being removed, is run in a container without |
I can partially work around this on the Podman side by making our refresh code smarter (but slower) and actually querying c/storage and runc to see what the container is doing at the moment. However, I can't fix c/storage losing the mount counter because /var/run was changed, so I can't directly fix this on the Podman side. |
Also, unfortunately, This means we no longer have a way of working directly with c/storage containers that get orphaned. |
We should fix it, so that it also removes container images when told to --force. |
I don't see how that will help here? |
I would give you a way to cleanup |
I don't think that helps us? The issue here is that we don't know the container is mounted, so it's not unmounted, so attempting to remove storage doesn't work. |
@mheon whats the latest on this? |
This probably overlaps with the work we were talking about to show c/storage containers in |
We've dealt with these via |
This is not fixed and
|
Something is likely mounted at that directory (specifically, it seems like |
Why should I care about these things as a regular user? Removing a container should work without any crazy workarounds and hacking around bugs. Especially because podman wants to be a drop-in replacement of Docker. |
We are aware of this issue, and I understand that it sucks - this is definitely something that Podman should be handling automatically. There's an issue somewhere in containers/storage where containers can be registered as successfully unmounted despite the unmount failing, so our tools don't know they have to unmount on trying to remove. Thus far, this has been a very rare occurrence, so hopefully you won't have to worry about this again. If you can consistently reproduce, though, we'd love to have your help tracking this one down - it's very difficult to figure out what's going wrong when we can't manage to reproduce the issue ourselves. |
Is this issue I'm having related to this? I am trying to create a container with the same name that is already removed and failing:
How can I fix this? |
Try |
Thanks, that got me past that point but now it looks like it resulted in some sort of permissions problem:
|
Looks like it may be related to this: https://discussion.fedoraproject.org/t/toolbox-broken-again-crun-update-in-31-20191112-0/11369/19 Two bugs in one day, yay! I'm not really sure what I'm supposed to do here. I can reboot to clear the OCI error until I create a container of the same name as one that has already been deleted. When I workaround that with |
This seems like it could be a crun issue - @giuseppe Regardless, this one is (probably) not Podman. |
I hit this problem again:
|
@shlao which version of podman are you running? I found that podman >= 1.7.0 fixed this issue for me. F31 is already at 1.8.0 but it looks like you are using CentOS 7. |
|
Patches for this were landed in 1.7.0, and should be in RHEL 8.2.1 (which will include a 1.9.x release of Podman). |
@mheon Do you know when / if this will land in RHEL/CentOS 7.9? I'm running ceph via cephadm and podman and I'm having to restart the host after every container gets upgraded because of this issue. |
There are no plans for further Podman releases on Cent/RHEL 7 - I believe 1.6.4 in 7.8 will be the last. |
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
A script launch the following command to start a container with the
rm
flag so the contianer will be destroyed at exit but when I try to recreate a container manually with the same podman command, podman fail to create the container and display the following error:When I try to inspect for an existing volume or something like that I doesn't found any results:
Look like similar to #1359
Steps to reproduce the issue:
podman run --rm
command twicesDescribe the results you received:
Describe the results you expected:
I'm waiting for a container creation
Additional information you deem important (e.g. issue happens only occasionally):
Output of
podman version
:Output of
podman info
:Additional environment details (AWS, VirtualBox, physical, etc.):
KVM
The text was updated successfully, but these errors were encountered: