Skip to content

Container remove (or create?) is not atomic and does break name unicity #4239

Open
@apostasie

Description

@apostasie

Description

It is possible to produce conditions where the name store ends-up with multiple references for the same name.

While the namestore implementation has been fixed to be atomic, the rest of the flow might not be

It is presumably hard to have a simple reproducer, but here is how I got there:

Loop through rm and run:

while true; do nerdctl rm -f foo; nerdctl run -ti --name foo debian echo lol;  done

Then try to kill it "at the right time". Best way is probably to concurrently make binaries to fuck with the execution flow (this is assuming your nerdctl is ran from the build location).

Suggesting to review rm and run flow and ensure we implement this atomically, or at least have some recovery mechanism.

Steps to reproduce the issue

Describe the results you received and expected

Not break name unicity.

What version of nerdctl are you using?

main

Are you using a variant of nerdctl? (e.g., Rancher Desktop)

None

Host information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions