From e7043fe2841431f573bb435fffa0996b951949f1 Mon Sep 17 00:00:00 2001 From: Snir Sheriber Date: Wed, 13 Jan 2021 14:52:15 +0200 Subject: [PATCH] shimv2: log a warning and continue on post-stop hook failure According to runtime-spec: The poststop hooks MUST be invoked by the runtime. If any poststop hook fails, the runtime MUST log a warning, but the remaining hooks and lifecycle continue as if the hook had succeeded. Fixes: #1252 Signed-off-by: Snir Sheriber --- src/runtime/containerd-shim-v2/delete.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/containerd-shim-v2/delete.go b/src/runtime/containerd-shim-v2/delete.go index f1d7ebbc5e..554899afa1 100644 --- a/src/runtime/containerd-shim-v2/delete.go +++ b/src/runtime/containerd-shim-v2/delete.go @@ -29,7 +29,9 @@ func deleteContainer(ctx context.Context, s *service, c *container) error { // Run post-stop OCI hooks. if err := katautils.PostStopHooks(ctx, *c.spec, s.sandbox.ID(), c.bundle); err != nil { - return err + // log warning and continue, as defined in oci runtime spec + // https://github.com/opencontainers/runtime-spec/blob/master/runtime.md#lifecycle + shimLog.WithError(err).Warn("Failed to run post-stop hooks") } if c.mounted {