Skip to content

Commit e0ec87b

Browse files
committed
runtime: Add post-stop hooks to the lifecycle
These just landed via #202. I'm not entirely clear on how we intend to handle "the application died before we finished executing post-stop hooks", but I've made my best guess here. Signed-off-by: W. Trevor King <wking@tremily.us>
1 parent 1b458b7 commit e0ec87b

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

runtime-config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ If a hook returns a non-zero exit code, [then an error including the exit code a
2626

2727
### Post-start
2828

29-
The post-start hooks are called after the user process is started.
29+
The post-start hooks are called [after the user process is started](runtime.md#typical-lifecycle).
3030
For example this hook can notify user that real process is spawned.
3131

3232
If a hook returns a non-zero exit code, then an error is logged and the remaining hooks are executed.

runtime.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,18 @@ A typical lifecyle progresses like this:
3939
4. The runtime executes any [pre-start hooks](runtime-config.md#pre-start)
4040
5. The runtime [executes the container process](#start-process)
4141
6. The container process is running
42-
7. A user tells the runtime to send a termination signal to the container process
43-
8. The runtime [sends a termination signal to the container process](#stop-process)
44-
9. The container process exits
45-
10. The runtime [terminates any other processes in the container](#stop-process)
46-
11. The runtime executes any [post-stop hooks](runtime-config.md#post-stop)
47-
12. The runtime [removes the container](#cleanup)
42+
7. The runtime executes any [post-start hooks](runtime-config.md#post-start)
43+
8. A user tells the runtime to send a termination signal to the container process
44+
9. The runtime [sends a termination signal to the container process](#stop-process)
45+
10. The container process exits
46+
11. The runtime [terminates any other processes in the container](#stop-process)
47+
12. The runtime executes any [post-stop hooks](runtime-config.md#post-stop)
48+
13. The runtime [removes the container](#cleanup)
4849

4950
With steps 7 and 8, the user is explicitly stopping the container process (via the runtime), but it's also possible that the container process could exit for other reasons.
50-
In that case we skip directly from 6 to [10](#stop-process).
51+
In that case we skip directly from 6 to [10](#stop-process), skipping any post-start hooks that hadn't been launched and terminating any in-progress post-start hook.
5152

52-
Failure in a pre-start hook or other setup task can cause a jump straight to [11](runtime-config.md#post-stop).
53+
Failure in a pre-start hook or other setup task can cause a jump straight to [12](runtime-config.md#post-stop).
5354

5455
### Create
5556

0 commit comments

Comments
 (0)