From c59e20a7852dd43eb54dd30b2ea8c67152f31172 Mon Sep 17 00:00:00 2001 From: Abel Feng Date: Fri, 2 Aug 2024 17:34:18 +0800 Subject: [PATCH] runtime: fail when a poststop hook fails If a poststop hook run failed(maybe because the resource is still not ready to be recycled), we expect that the delete operation could fail and be retried util all poststop hooks run succeed. Signed-off-by: Abel Feng --- config.md | 3 ++- runtime.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config.md b/config.md index b9b55737c..a38dceaa3 100644 --- a/config.md +++ b/config.md @@ -634,7 +634,8 @@ The `poststart` hooks MUST be executed in the [runtime namespace](glossary.md#ru ### Poststop -The `poststop` hooks MUST be called [after the container is deleted](runtime.md#lifecycle) but before the [`delete`](runtime.md#delete) operation returns. +The `poststop` hooks MUST be called [after the user-specified process is killed](runtime.md#lifecycle), but before the [`delete`](runtime.md#delete) operation return. +Runtime should make sure that if a `poststop` hook failed, the [`delete`](runtime.md#delete) operation could fail and be retried. Cleanup or debugging functions are examples of such a hook. The `poststop` hooks' path MUST resolve in the [runtime namespace](glossary.md#runtime-namespace). diff --git a/runtime.md b/runtime.md index d3aaa9b14..870a3a272 100644 --- a/runtime.md +++ b/runtime.md @@ -76,7 +76,7 @@ The lifecycle describes the timeline of events that happen from when a container 11. Runtime's [`delete`](runtime.md#delete) command is invoked with the unique identifier of the container. 12. The container MUST be destroyed by undoing the steps performed during create phase (step 2). 13. The [`poststop` hooks](config.md#poststop) MUST be invoked by the runtime. - If any `poststop` hook fails, the runtime MUST [log a warning](#warnings), but the remaining hooks and lifecycle continue as if the hook had succeeded. + If any `poststop` hook fails, the runtime MUST [generate an error](#errors), so that the Runtime's [`delete`](runtime.md#delete) command fails and retry is required until all `poststop` hooks succeed. ## Errors