Skip to content

ctr task delete -f cannot delete tasks with PID 0 #10441

@Iceber

Description

@Iceber

Description

Deleting tasks with PID 0 via task.Delete(ctx, WithProcessKill) or ctr task delete -f will block due to task.Wait.
When we delete many tasks, it may not work as well as we would like, and will block on the task with pid 0.

Steps to reproduce the issue

The steps to reproduce refer to #7357

  1. ctr -n demo i pull docker.io/library/redis:latest
  2. ctr -n demo c create docker.io/library/redis:latest redis
  3. ctr -n demo task start -d redis
  4. ctr -n demo c checkpoint --rw --image --task redis redis-checkpoint
  5. ctr -n demo i ls | grep redis-checkpoint
  6. find checkpoint config digest in image manifest: for me the image manifest is at /var/lib/containerd/io.containerd.content.v1.content/blobs/sha256/{digest of image}, and the checkpoint config has type application/vnd.containerd.container.checkpoint.config.v1+proto
  7. the checkpoint config file describes the OCI spec of the checkpointed container, modify it so that runc fails to restore: For instance, I replaced namespace type: pid with type: not, which will cause restore to fail. NOTE: if your edit changes the size of the checkpoint config file containerd will fail to parse it, so you will not make it to runc failing to restore, which reveals the issue at hand.
  8. container restore: ctr -n demo c restore --rw --live redis-checkpoint redis-checkpoint. This command will fail, and a task will be left with status created.
  9. ctr -n demo task delete -f redis-checkpoint

Describe the results you received and expected

I want to force delete any tasks that containerd allows to exist, such as tasks with PID 0

What version of containerd are you using?

containerd github.com/containerd/containerd v1.7.13 7c3aca7

Any other relevant information

No response

Show configuration if it is related to CRI plugin.

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions