Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: fix containerd pid may be reuse #2679

Merged

Conversation

HusterWan
Copy link
Contributor

@HusterWan HusterWan commented Jan 21, 2019

Signed-off-by: Michael Wan zirenwan@gmail.com

Ⅰ. Describe what this PR did

In case containerd process may still alive on the host when the pouchd starting, we cache the containerd pid in a file container.pid and the pid file will be deleted when the pouchd exited.

In this case, we can check if the pid of containerd still alive, if true pouchd will not run a new containerd instance, but just take over the old containerd instance.

But there has a situation that the pid file cannot be deleted that the host was broken down by accident, and when the host restart again the pid file record a pid reused by the other process but the containerd. So when the pouchd restarting, it will check the containerd is alived but cannot take over the process because the process is not the containerd.

Ⅱ. Does this pull request fix one issue?

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

add PouchDaemonSuite.TestContainerdPIDReuse

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@codecov
Copy link

codecov bot commented Jan 21, 2019

Codecov Report

Merging #2679 into master will decrease coverage by 0.06%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2679      +/-   ##
==========================================
- Coverage   69.19%   69.13%   -0.07%     
==========================================
  Files         278      278              
  Lines       17392    17415      +23     
==========================================
+ Hits        12035    12040       +5     
- Misses       4028     4048      +20     
+ Partials     1329     1327       -2
Flag Coverage Δ
#criv1alpha2_test 39.2% <0%> (-0.16%) ⬇️
#integration_test_0 36.27% <0%> (+0.04%) ⬆️
#integration_test_1 35.19% <0%> (+0.02%) ⬆️
#integration_test_2 36.58% <0%> (+0.27%) ⬆️
#integration_test_3 35.11% <0%> (-0.04%) ⬇️
#node_e2e_test 34.98% <0%> (-0.05%) ⬇️
#unittest 27.36% <ø> (ø) ⬆️
Impacted Files Coverage Δ
ctrd/supervisord/daemon.go 49.06% <0%> (-8.18%) ⬇️
daemon/mgr/spec_linux.go 77.3% <0%> (-0.99%) ⬇️
cri/v1alpha2/cri.go 71.26% <0%> (ø) ⬆️
daemon/mgr/container.go 59.24% <0%> (+0.21%) ⬆️
ctrd/container.go 57.66% <0%> (+1.14%) ⬆️

@pouchrobot pouchrobot added kind/bug This is bug report for project size/M labels Jan 21, 2019
@HusterWan HusterWan force-pushed the zr/fix-ctrd-pid-duplicate branch from c0ec91a to a2d11d6 Compare January 21, 2019 14:55
@HusterWan HusterWan requested a review from fuweid January 22, 2019 01:52
@HusterWan HusterWan force-pushed the zr/fix-ctrd-pid-duplicate branch from a2d11d6 to 772275c Compare January 22, 2019 02:13
@HusterWan HusterWan force-pushed the zr/fix-ctrd-pid-duplicate branch 2 times, most recently from f24d5c8 to 463c541 Compare January 23, 2019 11:37
Signed-off-by: Michael Wan <zirenwan@gmail.com>
@HusterWan HusterWan force-pushed the zr/fix-ctrd-pid-duplicate branch from 463c541 to cfa6f64 Compare January 24, 2019 09:46
@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Jan 24, 2019
@rudyfly
Copy link
Collaborator

rudyfly commented Jan 28, 2019

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This is bug report for project LGTM one maintainer or community participant agrees to merge the pull reuqest. size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants