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.
@@ -226,11 +226,14 @@ func (s *shim) Delete(ctx context.Context) (*runtime.Exit, error) {
ID: s.ID(),
})
if shimErr != nil {
+ 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
// this seems dirty but it cleans up the API across runtimes, tasks, and the service
s.rtTasks.Delete(ctx, s.ID())
