From 1130a0bc101c3f59c99eb850b24d0799c216d677 Mon Sep 17 00:00:00 2001
From: xiadanni1 <xiadanni1@huawei.com>
Date: Fri, 22 Mar 2019 21:22:08 +0800
Subject: [PATCH] restore:  delete task in containerd restoring

reason: delete task quickly when containerd is restoring to avoid container restart fail.

Change-Id: Ide5e8c9bbd873addc6c35b9604e4cda03ca78b5e
Signed-off-by: xiadanni1 <xiadanni1@huawei.com>
---
 runtime/v1/linux/runtime.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/runtime/v1/linux/runtime.go b/runtime/v1/linux/runtime.go
index e92904e..2a45aaa 100644
--- a/runtime/v1/linux/runtime.go
+++ b/runtime/v1/linux/runtime.go
@@ -426,7 +426,11 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) {
 			continue
 		}
 		if pid <= 0 {
-			log.G(ctx).Warnf("skip load task in creating %s", id)
+			go func() {
+				log.G(ctx).Infof("del task in creating %s", id)
+				t.DeleteForce(ctx, uint32(pid))
+				log.G(ctx).Infof("del task in creating %s done", id)
+			}()
 			continue
 		}
 		if events.InitExitExist(bundle.path) {
-- 
1.8.3.1

