-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Description
We created a HostPID pod that has shared pid namespace with host. The container process was killed and then restarted again and agian. We found that the container cgroup path under /sys/fs/cgroup/<subsystem>/kubepods/podxxx-xxx/<contaienrID>/ was left.
The reason is that runc kill or runc delete did not really wait for the exit of container children process, p.wait() will receive ECHILD immediately, see https://github.com/opencontainers/runc/blob/v1.1.9/libcontainer/init_linux.go#L585C18-L585C18. If any child process is still running, the cgroup path couldn't be removed.
Steps to reproduce the issue
- Create a HostPID pod, the container has many children process died and new born.
- Kill the main container process for many times.
- Container will be restart again by kubelet.
Describe the results you received and expected
Expected: The container cgroup path is deleted.
Received: Still exist.
What version of runc are you using?
runc version 1.1.9
commit: v1.1.9-0-gccaecfcb
spec: 1.0.2-dev
go: go1.20.3
libseccomp: 2.5.4
Host OS information
No response
Host kernel information
No response