AliyunContainerService / pouch

An Efficient Enterprise-class Container Engine
https://pouchcontainer.io
Apache License 2.0
4.64k stars 949 forks source link

fix: exec config leak in cri exec #3000

Closed zhuangqh closed 5 years ago

zhuangqh commented 5 years ago

mark execConfig as exited and used when start exec fails exec gc will collect this config

Signed-off-by: zhuangqh zhuangqhc@gmail.com

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

exec config object would leak in memory after CRI ExecSync

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

Ⅳ. Describe how to verify it

  1. crictl exec into a container
  2. inspect container and execconfig will be empty after several minutes.

Ⅴ. Special notes for reviews

codecov[bot] commented 5 years ago

Codecov Report

Merging #3000 into master will increase coverage by 0.62%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3000      +/-   ##
==========================================
+ Coverage   67.41%   68.03%   +0.62%     
==========================================
  Files         291      291              
  Lines       18660    18663       +3     
==========================================
+ Hits        12579    12697     +118     
+ Misses       4572     4484      -88     
+ Partials     1509     1482      -27
Flag Coverage Δ
#criv1alpha2_test 34.44% <11.11%> (-0.22%) :arrow_down:
#integration_test_0 36.4% <11.11%> (-0.01%) :arrow_down:
#integration_test_1 35.48% <100%> (+0.02%) :arrow_up:
#integration_test_2 36.37% <11.11%> (+0.01%) :arrow_up:
#integration_test_3 35.8% <11.11%> (?)
#node_e2e_test 34.01% <11.11%> (-0.21%) :arrow_down:
#unittest 26.68% <0%> (-0.01%) :arrow_down:
Impacted Files Coverage Δ
daemon/mgr/container_exec.go 80% <100%> (+0.42%) :arrow_up:
ctrd/watch.go 72.72% <0%> (-5.2%) :arrow_down:
ctrd/container.go 50.62% <0%> (-0.36%) :arrow_down:
apis/server/router.go 91.95% <0%> (+0.57%) :arrow_up:
daemon/mgr/spec_linux.go 79.26% <0%> (+1%) :arrow_up:
daemon/mgr/container_stats.go 71.66% <0%> (+1.11%) :arrow_up:
daemon/mgr/image.go 61.17% <0%> (+1.3%) :arrow_up:
ctrd/supervisord/daemon.go 49.12% <0%> (+1.31%) :arrow_up:
daemon/mgr/container_validation.go 40.09% <0%> (+1.8%) :arrow_up:
registry/auth.go 55.14% <0%> (+1.86%) :arrow_up:
... and 14 more