Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Commit 80811d6

Browse files
committed
shimv2: log a warning and continue on post-start hook failure
According to runtime-spec: The poststart hooks MUST be invoked by the runtime. If any poststart hook fails, the runtime MUST log a warning, but the remaining hooks and lifecycle continue as if the hook had succeeded backport from 2.0, kata-containers/kata-containers#1253 Fixes: #3126 Signed-off-by: Snir Sheriber <[email protected]>
1 parent 2938498 commit 80811d6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

containerd-shim-v2/start.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111

1212
"github.com/containerd/containerd/api/types/task"
1313
"github.com/kata-containers/runtime/pkg/katautils"
14+
15+
"github.com/sirupsen/logrus"
1416
)
1517

1618
func startContainer(ctx context.Context, s *service, c *container) error {
@@ -52,7 +54,9 @@ func startContainer(ctx context.Context, s *service, c *container) error {
5254
return katautils.PostStartHooks(ctx, *c.spec, s.sandbox.ID(), c.bundle)
5355
})
5456
if err != nil {
55-
return err
57+
// log warning and continue, as defined in oci runtime spec
58+
// https://github.com/opencontainers/runtime-spec/blob/master/runtime.md#lifecycle
59+
logrus.WithError(err).Warn("Failed to run post-start hooks")
5660
}
5761

5862
c.status = task.StatusRunning

0 commit comments

Comments
 (0)