+
Skip to content

CRIO does not clean all running process when killed container #9263

@ryanlyy

Description

@ryanlyy

What happened?

In kubernetes environment, if liveness fails, kubelet will restart the container. in the terminating container, some process become orphan process since there is no time to term and kill all processes in container and then kubelet delete that container.

in containerd, when container is killed, it will clean all running process in that container before exiting. but seems CRIO does not do same like contianerd.

https://github.com/containerd/containerd/blob/release/2.1/cmd/containerd-shim-runc-v2/task/service.go#L706

What did you expect to happen?

CRIO runtime can clean all running process in container before exit contianer

How can we reproduce it (as minimally and precisely as possible)?

normally default gracePeriod is 30, if you set preStop to sleep 30s, then there is only 2 second for process to terminating, if you have multiple processes in container and if some process is terminating more than 2seconds. then the later process will not received SIGTEM/SIGKILL. and then those process will become orphan process

Anything else we need to know?

No response

CRI-O and Kubernetes version

[root@master01 test]# oc version
Client Version: 4.16.0-202406282106.p0.ge4cacc0.assembly.stream-e4cacc0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: 4.16.2
Kubernetes Version: v1.29.6+aba1e8d

OS version

[root@master01 test]# oc version
Client Version: 4.16.0-202406282106.p0.ge4cacc0.assembly.stream-e4cacc0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: 4.16.2
Kubernetes Version: v1.29.6+aba1e8d
[root@master01 test]# uname -a
Linux master01.af02openshift.register.com 5.14.0-427.24.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Jun 23 11:48:35 EDT 2024 x86_64 x86_64 x86_64 GNU/Linux
[root@master01 test]# kubectl version
Client Version: v1.29.1
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.6+aba1e8d
[root@master01 test]#

Additional environment details (AWS, VirtualBox, physical, etc.)

physical

Metadata

Metadata

Labels

kind/bugCategorizes issue or PR as related to a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载