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: sync abnormal container status when start pouchd #1056

Conversation

HusterWan
Copy link
Contributor

@HusterWan HusterWan commented Apr 4, 2018

Signed-off-by: Michael Wan [email protected]

Ⅰ. Describe what this PR did

Killing a container after pouchd service quit, then start the pouchd service, the killed container's status still be running

so we must sync all abnormal containers's status when starting the pouchd service.

  1. pouch ps choose a container to perform an experiment, in this case, we choose 80ec87
root@osboxes:pouch (master) -> pouch ps
Name     ID       Status       Created       Image                                            Runtime
c19218   c19218   Up 2 hours   2 hours ago   registry.hub.docker.com/library/busybox:latest   runc
adb4df   adb4df   Up 2 hours   2 hours ago   registry.hub.docker.com/library/busybox:latest   runc
80ec87   80ec87   Up 2 hours   2 hours ago   registry.hub.docker.com/library/busybox:latest   runc
6dd2b3   6dd2b3   Up 2 hours   2 hours ago   registry.hub.docker.com/library/busybox:latest   runc
6f3fd2   6f3fd2   Up 3 hours   3 hours ago   registry.hub.docker.com/library/busybox:latest   runc
  1. kill the container process after pouchd service quit.
root@osboxes:pouch (master) -> ps aux | grep 80ec87
root     14196  0.0  0.0 112660   976 pts/3    S+   04:19   0:00 grep --color=auto 80ec87
root     31751  0.0  0.1   8924  2860 pts/5    Sl   01:22   0:00 containerd-shim -namespace default -workdir /var/lib/pouch/containerd/root/io.containerd.runtime.v1.linux/default/80ec87c8336f4856507cdcdbbabb7e4d0dd83fc2b7325d1de7da05447a42435a -address /var/run/containerd.sock -containerd-binary /usr/local/bin/containerd -runtime-root /run
root@osboxes:pouch (master *) -> kill 31751
  1. start pouchd service again, then the container'status should be stopped:
root@osboxes:pouch (master *) -> pouch ps -a
Name     ID       Status       Created       Image                                            Runtime
c19218   c19218   stopped      3 hours ago   registry.hub.docker.com/library/busybox:latest   runc
adb4df   adb4df   stopped      3 hours ago   registry.hub.docker.com/library/busybox:latest   runc
80ec87   80ec87   stopped      3 hours ago   registry.hub.docker.com/library/busybox:latest   runc
6dd2b3   6dd2b3   Up 3 hours   3 hours ago   registry.hub.docker.com/library/busybox:latest   runc
6f3fd2   6f3fd2   Up 4 hours   4 hours ago   registry.hub.docker.com/library/busybox:latest   runc

pouch daemon logs:

INFO[2018-04-04 04:32:39.486542348] start to subscribe io, backend: raw-file, id: 80ec87c8336f4856507cdcdbbabb7e4d0dd83fc2b7325d1de7da05447a42435a
INFO[2018-04-04 04:32:39.486581339] start to subscribe io, backend: raw-file, id: 80ec87c8336f4856507cdcdbbabb7e4d0dd83fc2b7325d1de7da05447a42435a
INFO[2018-04-04 04:32:39.487461066] container 80ec87c8336f4856507cdcdbbabb7e4d0dd83fc2b7325d1de7da05447a42435a not found, executes mark stopped and release resources
INFO[2018-04-04 04:32:39.487488548] close containerio backend: raw-file, id: 80ec87c8336f4856507cdcdbbabb7e4d0dd83fc2b7325d1de7da05447a42435a
INFO[2018-04-04 04:32:39.487497633] close containerio backend: raw-file, id: 80ec87c8336f4856507cdcdbbabb7e4d0dd83fc2b7325d1de7da05447a42435a
DEBU[2018-04-04 04:32:39.487510865] remove endpoint: f2c12b8f88d38a17ada0d0dd8258f9d81aaed35340a62f95a8a44a088a64f676 on network: bridge
INFO[2018-04-04 04:32:39.488640036] finished to subscribe io, backend: raw-file, id: 80ec87c8336f4856507cdcdbbabb7e4d0dd83fc2b7325d1de7da05447a42435a
INFO[2018-04-04 04:32:39.488669273] finished to subscribe io, backend: raw-file, id: 80ec87c8336f4856507cdcdbbabb7e4d0dd83fc2b7325d1de7da05447a42435a

Ⅱ. Does this pull request fix one issue?

fixes #898 #927

Ⅲ. Describe how you did it

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@pouchrobot pouchrobot added kind/bug This is bug report for project size/S labels Apr 4, 2018
@HusterWan HusterWan force-pushed the zr/sync-stopped-container-status branch from d132861 to e1cd2da Compare April 8, 2018 08:49
@codecov-io
Copy link

Codecov Report

Merging #1056 into master will increase coverage by 0.27%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1056      +/-   ##
==========================================
+ Coverage   16.48%   16.75%   +0.27%     
==========================================
  Files         158      158              
  Lines        8841     8770      -71     
==========================================
+ Hits         1457     1469      +12     
+ Misses       7281     7196      -85     
- Partials      103      105       +2
Impacted Files Coverage Δ
daemon/mgr/container.go 5.08% <0%> (-0.03%) ⬇️
pkg/kernel/kernel.go 72.72% <0%> (-7.28%) ⬇️
daemon/containerio/container_io.go 0% <0%> (ø) ⬆️
client/client.go 35.48% <0%> (+2.15%) ⬆️

@allencloud
Copy link
Collaborator

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Apr 16, 2018
@allencloud allencloud merged commit 1f2b6ee into AliyunContainerService:master Apr 16, 2018
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/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] pouch container status not stay with containerd container status
4 participants