Skip to content

Spec poststop hook behaviour is different from the popular implementations #1309

@fspv

Description

@fspv

Hey. I was recently working on testing the hooks behaviour for youki and runc and noticed that the poststop hook behaviour described in the spec is different from what's actually implemented in these runtimes.

The spec (https://github.com/opencontainers/runtime-spec/blob/main/runtime.md#lifecycle) states:

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.

Where https://github.com/opencontainers/runtime-spec/blob/main/runtime.md#warnings is defined as:

logging a warning does not change the flow of the operation; it MUST continue as if the warning had not been logged.

This contradicts the actual implementation, where if any poststop hook fails the subsequent hooks are not executed and the error is propagated to the caller.

This also contradicts the behaviour of the other hooks. Poststop is the only hook type with this "warn and continue" requirement. All other hooks (prestart, createRuntime, createContainer, startContainer, poststart) require generating an error on failure.

This had already been flagged with runc opencontainers/runc#1765 (decision was not to fix it) and youki youki-dev/youki#3407 (no decision yet).

In my opinion it is better to adjust the specification for consistency with the existing implementations and the other hooks, because it will make it simpler and more intuitive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions