From 0116352e1bfb944237f5053695cd2251f285a45f Mon Sep 17 00:00:00 2001 From: Wei Fu Date: Mon, 20 Apr 2020 22:42:53 +0800 Subject: [PATCH] runtime: ignore ttrpc.ErrClosed when delete task For some reason, shimv2 process doesn't exist. The ttrpc doesn't detect the connection closed by server until delete task. For this case, we should ignore the ttrpc.ErrClosed and let task manager handle the cleanup. Signed-off-by: Wei Fu --- runtime/v2/shim.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/runtime/v2/shim.go b/runtime/v2/shim.go index 48e411d2c..abb71621f 100644 --- a/runtime/v2/shim.go +++ b/runtime/v2/shim.go @@ -226,9 +226,12 @@ func (s *shim) Delete(ctx context.Context) (*runtime.Exit, error) { ID: s.ID(), }) if shimErr != nil { - shimErr = errdefs.FromGRPC(shimErr) - if !errdefs.IsNotFound(shimErr) { - return nil, shimErr + log.G(ctx).WithField("id", s.ID()).WithError(shimErr).Debug("failed to delete task") + if errors.Cause(shimErr) != ttrpc.ErrClosed { + shimErr = errdefs.FromGRPC(shimErr) + if !errdefs.IsNotFound(shimErr) { + return nil, shimErr + } } } // remove self from the runtime task list