Skip to content

Remove directories for removed containers on the host #65

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

Closed
samuelkarp opened this issue Jan 10, 2019 · 4 comments
Closed

Remove directories for removed containers on the host #65

samuelkarp opened this issue Jan 10, 2019 · 4 comments
Labels
area/runtime base functionality Basic container functionality issue kind/bug Something isn't working

Comments

@samuelkarp
Copy link
Contributor

samuelkarp commented Jan 10, 2019

[ec2-user@ip-172-31-30-18 ~]$ sudo /usr/local/bin/ctr run --snapshotter firecracker-naive --runtime aws.firecracker --tty docker.io/library/busybox:latest test
/ # echo hello
hello
/ # exit
[ec2-user@ip-172-31-30-18 ~]$ sudo /usr/local/bin/ctr c rm test
[ec2-user@ip-172-31-30-18 ~]$ sudo /usr/local/bin/ctr run --snapshotter firecracker-naive --runtime aws.firecracker --tty docker.io/library/busybox:latest test
ctr: mkdir /run/containerd/io.containerd.runtime.v2.task/default/test: file exists: unknown

Even though I've deleted the container (and its snapshot) on the host, the microVM rootfs the host retains the bundle directory that was created for the container. We should either clean up the bundle directory when the container is removed (or stopped?), or we should ensure that the microVM rootfs is read-only (or separate per microVM).

@samuelkarp samuelkarp added kind/bug Something isn't working base functionality Basic container functionality issue area/agent labels Jan 10, 2019
@samuelkarp
Copy link
Contributor Author

Per discussion with @IRCody yesterday, he thinks that the error relates to a path on the host instead of inside the microVM. When I look on the host, I do see what he's talking about:

[ec2-user@ip-172-31-30-18 ~]$ sudo ls /run/containerd/io.containerd.runtime.v2.task/default/test
address  config.json  firecracker.sock	log  rootfs  shim.pid  work

I'm not sure what is supposed to clean up this directory, maybe the runtime?

@IRCody
Copy link
Contributor

IRCody commented Jan 10, 2019

I think the runtime is supposed to clean it up. I think this comment is wrong and we actually do need to clean some stuff up here.

Reading the docs it looks like there are two scenarios:

  • containerd will call cleanup() over RPC.
  • containerd is expecting to call the runtime binary with the "delete" subcommand when RPC calls fail expects that runtime binary to cleanup any state left by the other one. That delete call gets processed here which calls cleanup.

@samuelkarp samuelkarp changed the title Remove directories for removed containers inside the microVM Remove directories for removed containers on the host Mar 19, 2019
@samuelkarp
Copy link
Contributor Author

There appear to be additional leftover files in /run/containerd/fifo.

@samuelkarp
Copy link
Contributor Author

I was able to fix the non-deletion locally, but that seems to have exposed another bug where subsequent containers launched with the same ID seem to have the IO streams disconnected after launch (i.e., the firecracker and runtime processes remain running but ctr exits with an error).

kzys added a commit to kzys/firecracker-containerd that referenced this issue Jul 17, 2019
While we cannot repro firecracker-microvm#65 anymore, we'd like to have some tests to
prevent regression.

Closes firecracker-microvm#65.

Signed-off-by: Kazuyoshi Kato <[email protected]>
kzys added a commit to kzys/firecracker-containerd that referenced this issue Jul 19, 2019
We are not deleting the files associated with a container correctly,
as firecracker-microvm#65 suggested.

The existing test didn't unveil the issue since the shim is deleting
the files along with the files associated with the shim.
kzys added a commit to kzys/firecracker-containerd that referenced this issue Jul 22, 2019
We are not deleting the files associated with a container correctly,
as firecracker-microvm#65 suggested.

The existing test didn't unveil the issue since the shim is deleting
the files along with the files associated with the shim.

Signed-off-by: Kazuyoshi Kato <[email protected]>
@kzys kzys closed this as completed in 118e9c6 Jul 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/runtime base functionality Basic container functionality issue kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants