Move poststart hook from runc create to runc start#5186
Move poststart hook from runc create to runc start#5186kolyshkin wants to merge 3 commits intoopencontainers:mainfrom
Conversation
Rename c.signal to c.signalInit, and add c.signal which is a lock-less form of c.Signal. To be used by the next patch. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
No functional change. To be used by the next patch. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
The runtime-spec [1] currently says: > 6. Runtime's start command is invoked with the unique identifier of > the container. > 7. The startContainer hooks MUST be invoked by the runtime. If any > startContainer hook fails, the runtime MUST generate an error, stop > the container, and continue the lifecycle at step 12. > 8. The runtime MUST run the user-specified program, as specified by > process. > 9. The poststart hooks MUST be invoked by the runtime. If any > poststart hook fails, the runtime MUST generate an error, stop the > container, and continue the lifecycle at step 12. > ... > 11. Runtime's 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 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. Currently, we do 9 before 8 (heck, even before 6), which is clearly against the spec and results in issues like the one described in [2]. Let's move running poststart hook to after the user-specified process has started. NOTE this patch only fixes the order and does not implement removing the container when the poststart hook failed (as this part of the spec is controversial -- destroy et al and should probably be, and currently are, part of "runc delete"). [1]: https://github.com/opencontainers/runtime-spec/blob/main/runtime.md#lifecycle [2]: opencontainers#5182 Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
|
We will have to revert this if it breaks anyone. But I don't think hooks are so used (they were mostly unexported to upper layers), so hopefully we can do this and no one notices? |
|
I thought we decided to just keep the broken poststart hook as is and push people to use the new createRuntime and friends? EDIT: I think the issue is that opencontainers/runtime-spec#1169 missed a few changes when changing the explanation of |
|
I suspect the issue is we just need to update the lifecycle doc in the spec, since the description of
|
|
@cyphar this one is about poststart only. Only Currently runc implements I feel we need to fix the discrepancy in one way or another. |
|
@kolyshkin I built runc from your branch poststart (git commit 2d88d2e). |
The runtime-spec 1 currently says:
Currently, we do 9 before 8 (heck, even before 6), which is clearly
against the spec and results in issues like the one described in 2.
Let's move running poststart hook to after the user-specified process
has started.
NOTE this patch only fixes the order and does not implement removing
the container when the poststart hook failed (as this part of the spec
is controversial -- destroy et al and should probably be, and currently
are, part of "runc delete").
Fixes: #5182
Fixes: #4347
Closes: #4348