-
Notifications
You must be signed in to change notification settings - Fork 950
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
ctrd: try to fix fail to destroy container #2661
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2661 +/- ##
==========================================
- Coverage 69.72% 66.18% -3.54%
==========================================
Files 281 283 +2
Lines 18699 18904 +205
==========================================
- Hits 13037 12512 -525
- Misses 4213 5049 +836
+ Partials 1449 1343 -106
|
ctrd/container.go
Outdated
@@ -396,7 +396,16 @@ func (c *Client) destroyContainer(ctx context.Context, id string, timeout int64) | |||
clean: | |||
if err := pack.container.Delete(ctx); err != nil { | |||
if !errdefs.IsNotFound(err) { | |||
return msg, errors.Wrap(err, "failed to delete container") | |||
// try to delete task again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should check any others to call container.Delete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think no need, check the error message I write in the commit, for normal remove process, code under clean will not take effect, only deal with some error case, and not always have effect.
we got error in stop pouch container ``` the task has quit, id: 6a8dd031f5c87b4c67813908bbe7d3b3d96239e0054dd2516b411c88f7aa681f, err: <nil>, exitcode: 137, time: 2019-01-02 14:18:19.201110172 +0000 UTC" failed to delete task, container id: 6a8dd031f5c87b4c67813908bbe7d3b3d96239e0054dd2516b411c88f7aa681f: task must be stopped before deletion: running: failed precondition failed to delete container, container id: 6a8dd031f5c87b4c67813908bbe7d3b3d96239e0054dd2516b411c88f7aa681f: cannot delete running task 6a8dd031f5c87b4c67813908bbe7d3b3d96239e0054dd2516b411c88f7aa681f: failed precondition" ``` For checking containerd code, the problem probably happend maybe: when called delete task, first get task status, taskService().Get() -> processFromContainerd -> shim.State() -> init.Status() -> p.runtime.State() containerd-shim not use init proc status as container status, they should always keep same, but obviously, here is not. Signed-off-by: Ace-Tang <aceapril@126.com>
LGTM |
we got error in stop pouch container
For checking containerd code, the problem probably happend maybe:
when called delete task, first get task status, taskService().Get()
-> processFromContainerd -> shim.State() -> init.Status() -> p.runtime.State()
containerd-shim not use init proc status as container status, they
should always keep same, but obviously, here is not.
Signed-off-by: Ace-Tang aceapril@126.com
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews