Shim有时不会被StopPodSandbox清理
说明
在运行集成测试套件时,我发现TestContainerdRestart大约30%的时间会泄露出一个shim过程. 我得以把原因缩小到为未准备好的散装箱退出集装箱所创造的任务。 从试验容器再起试验中去除不相干的部分,可通过以下试验来复制泄漏:
开始 软件包集成
导入( E) 内容 "惊叹" "测试"
“GitHub.com/集装箱/集装箱/v2/客户” “GitHub.com/stretchr/测试/装潢” 运行时间“ k8s.io/ cri- api/ pkg/ apis/ runtime/v1” (中文(简体) ).
func TestShimFileleak Reductioner (t * testing.T) { 试金石 试金石 : ctx:=上下文. 背景情况( )
sbCfg:=PodSandbox Config ("测试-sandbox"),"测试-shim-file-leak-republicer"("测试-shim-file-leak-republicer") 互联网电影数据库(IMDb)上"测试-shim-file-leak-republicer"的资料(英文) sid, 错误 : = 运行时 Service. RunPodSandbox( sbCfg, "") 。没有错误( t, 错误)
页:1 "试验-容器","registry.k8s.io/停用:3.10","活塞". 使用 Pid Namespace( 运行时间.NamespaceMode CONPARER) , (中文(简体) ). cid, 错误 : = 运行时间 Service. CreateContainer( sid, cfg, sbCfg) 。没有错误( t, 错误)
错误=运行时间服务。 启动容器( CCD) 。没有错误( t, 错误)
cntr,错误:=容器粘度. 装入容器( ctx, sid) 。没有错误( t, 错误) 任务,错误 := cntr.task(ctx, 0) 。没有错误( t, 错误)
错误=任务。 Kill(ctx), syscall. SIGKILLL,已装入容器. 与杀戮) 。没有错误( t, 错误)
profile.no Error( t, 运行时服务. StopPodSandbox( sid)) 命令 profile.no Error(t, runtime Service. Remove PodSandbox( sid)) (没有) {\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}你觉得呢?
被泄露的过程由核心/运行时间/v2/binary/binary所创建. 运行命令 " /usr/local/bin/containerd-shim-runc-v2 - namespace k8.s.io - 地址/run/containerd/containerd.sock - publish-binary - usr/local/bin/containerd - id <container-id> " 时启动方法。 漏出只发生在容器任务被杀死时. 在杀死任务之前和之后增加拖延似乎不影响泄漏的频率。
根据与@samuelkarp的离线讨论, 停止PodSandbox在试图清理活塞资源时没有适当清理shim,而且似乎没有针对测试代码的特异性.
* 复制问题的步骤
1. 运行“去测试-运行”\ 测试容器再启动元” 或“ 去测试-运行测试ShimFileleak再生产元件” 多次
2. 检查 " pgrep - a controduced-shim " 并观察工艺已泄漏
描述你得到和期望的结果
结果
在运行 StopPodSandbox( sid)后, 这样的进程有时仍然存在:
`1537377/usr/local/bin/containerd-shim-runc-v2-namespace k8.s.io-id <sid>-地址/跑/集装箱/集装箱.sock'。
期望值
运行了 StopPodSandbox( sid)后,所有相关进程都应该被清理.
你用哪个版本的容器?
师傅
* 任何其他有关资料
不一样的 -a
Linux kpberry- containerd- test 6.1.0-21-cloud-amd64 #1 SMP PREEMPT DYNAMIC 德比安 6.1.90- 1个
. . . . . . .内容来源: containerd/containerd