Skip to content

namespace top level cgroup folders leaking #3305

@rcgoodfellow

Description

@rcgoodfellow

Description

When a container is created in a namespace, a top level cgroup directory is created for that namespace. When all resources are removed from a namespace, and the namespace is deleted, the corresponding top level cgroup directory remains.

Steps to reproduce the issue:
The following uses utilities from the cgroup-tools Debian package.

  1. Create a namespace, pull an image and run a container.
ctr namespace create llama
ctr -n llama image pull docker.io/library/debian:buster
ctr -n llama run -d docker.io/library/debian:buster buster /bin/true
  1. Observe the cgroup directory structure created
lscgroup | grep llama
net_cls,net_prio:/llama       
net_cls,net_prio:/llama/buster
cpu,cpuacct:/llama            
cpu,cpuacct:/llama/buster     
blkio:/llama                  
blkio:/llama/buster           
cpuset:/llama                 
cpuset:/llama/buster          
memory:/llama                 
memory:/llama/buster
pids:/llama
pids:/llama/buster
devices:/llama
devices:/llama/buster
freezer:/llama
freezer:/llama/buster
perf_event:/llama  
perf_event:/llama/buster
  1. Delete the image, container and namespace
ctr -n llama image rm --sync docker.io/library/debian:buster 
ctr -n llama c rm buster
ctr namespace rm llama
  1. Observe the cgroup directory structure that still exists
lscgroup | grep llama
net_cls,net_prio:/llama
cpu,cpuacct:/llama     
blkio:/llama           
cpuset:/llama          
memory:/llama          
pids:/llama            
devices:/llama         
freezer:/llama         
perf_event:/llama      

Describe the results you received:
cgroup top level directories that are created for containers in namespaces to not get deleted with the corresponding containerd namespace.

Describe the results you expected:
cgroup top level directory gets deleted when corresponding containerd namespace gets deleted.

Output of containerd --version:

containerd github.com/containerd/containerd v1.2.2 9754871865f7fe2f4e74d43e2fc7ccd237edcbce

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions