containerd/patch/0065-containerd-fix-dead-loop.patch
xiadanni 349a80d77f sync patches
1. check task list to avoid unnecessary cleanup.
2. fix dead loop
3. cleanup dangling shim by brand new context
4. fix potential panic for task in unknown state

Signed-off-by: xiadanni <xiadanni1@huawei.com>
2021-03-18 10:20:49 +08:00

38 lines
1.1 KiB
Diff

From b315a85a6695dfbe67767f21713c3ccfc7cae73e Mon Sep 17 00:00:00 2001
From: jingrui <jingrui@huawei.com>
Date: Mon, 1 Feb 2021 09:48:07 +0800
Subject: [PATCH] containerd: fix dead loop
Change-Id: I6b2ce4456ca8fe197683692721d150f4e5d7e3fe
Signed-off-by: jingrui <jingrui@huawei.com>
---
runtime/v1/shim/client/client.go | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/runtime/v1/shim/client/client.go b/runtime/v1/shim/client/client.go
index 06453b35a..9e63af4ea 100644
--- a/runtime/v1/shim/client/client.go
+++ b/runtime/v1/shim/client/client.go
@@ -393,15 +393,15 @@ func (c *Client) signalShim(ctx context.Context, sig syscall.Signal) error {
func (c *Client) waitForExit(pid int) <-chan struct{} {
c.exitOnce.Do(func() {
- for {
+ for i := 0; i < 1000; i++ {
// use kill(pid, 0) here because the shim could have been reparented
// and we are no longer able to waitpid(pid, ...) on the shim
if err := unix.Kill(pid, 0); err == unix.ESRCH {
- close(c.exitCh)
- return
+ break
}
time.Sleep(10 * time.Millisecond)
}
+ close(c.exitCh)
})
return c.exitCh
}
--
2.17.1