diff --git a/linux/runtime.go b/linux/runtime.go index 6f6567aaa..7b7d2b6a7 100644 --- a/linux/runtime.go +++ b/linux/runtime.go @@ -364,7 +364,10 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) { func (r *Runtime) cleanupAfterDeadShim(ctx context.Context, bundle *bundle, ns, id string, pid int, ec chan runc.Exit) error { ctx = namespaces.WithNamespace(ctx, ns) if err := r.terminate(ctx, bundle, ns, id); err != nil { - return errors.New("failed to terminate task, leaving bundle for debugging") + if r.config.ShimDebug { + return errors.Wrap(err, "failed to terminate task, leaving bundle for debugging") + } + log.G(ctx).WithError(err).Warn("failed to terminate task") } if ec != nil {