48 lines
1.6 KiB
Diff
48 lines
1.6 KiB
Diff
From 112c2ef89b1085e95959285ce5328af5d74ba8db Mon Sep 17 00:00:00 2001
|
|
From: xueshaojia <xueshaojia@huawei.com>
|
|
Date: Thu, 14 Feb 2019 10:48:14 +0800
|
|
Subject: [PATCH 19/27] restore: check shim alive when containerd is
|
|
restarted
|
|
|
|
reason: fix docker_containerd-shim:testCE_docker_containerd_shim_ABN.021.sh
|
|
When containerd is restarted, it will load all tasks.In some cases, the
|
|
containerd-shim is killed and the sock file will exist for a while.
|
|
Containerd should check the containerd-shim is available using the sock file.
|
|
If the containerd-shim server not responses, do r.cleanupAfterDeadShim
|
|
|
|
Change-Id: I448c8caefa8c1252bd5cdcff79deb8eff1005903
|
|
Signed-off-by: xueshaojia <xueshaojia@huawei.com>
|
|
---
|
|
runtime/v1/linux/runtime.go | 15 +++++++++++++++
|
|
1 file changed, 15 insertions(+)
|
|
|
|
diff --git a/runtime/v1/linux/runtime.go b/runtime/v1/linux/runtime.go
|
|
index 123d675..477cda0 100644
|
|
--- a/runtime/v1/linux/runtime.go
|
|
+++ b/runtime/v1/linux/runtime.go
|
|
@@ -343,6 +343,21 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) {
|
|
}
|
|
continue
|
|
}
|
|
+ ctxContact, cancel := context.WithTimeout(ctx, 5*time.Second)
|
|
+ defer cancel()
|
|
+ alive, err := s.IsAlive(ctxContact)
|
|
+ if !alive {
|
|
+ log.G(ctx).WithError(err).WithFields(logrus.Fields{
|
|
+ "id": id,
|
|
+ "namespace": ns,
|
|
+ }).Error("contacting to shim")
|
|
+ err := r.cleanupAfterDeadShim(ctx, bundle, ns, id, pid)
|
|
+ if err != nil {
|
|
+ log.G(ctx).WithError(err).WithField("bundle", bundle.path).
|
|
+ Error("cleaning up after dead shim")
|
|
+ }
|
|
+ continue
|
|
+ }
|
|
|
|
logDirPath := filepath.Join(r.root, ns, id)
|
|
|
|
--
|
|
2.7.4.3
|
|
|