Skip to content

Commit eea0fbf

Browse files
committed
docs: terminals: mention subreaper requirement
I realised that the terminal documentation which covers detached terminals fails to mention that callers need to make themselves a subreaper. Probably a good idea to mention this. I've also included a minor comparison to LXC. Signed-off-by: Aleksa Sarai <asarai@suse.de>
1 parent 80e2d1f commit eea0fbf

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/terminals.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,19 @@ Unfortunately using detached mode is a bit more complicated and requires more
228228
care than the foreground mode -- mainly because it is now up to the caller to
229229
handle the `stdio` of the container.
230230

231+
Another complication is that the parent process is responsible for acting as
232+
the subreaper for the container. In short, you need to call
233+
`prctl(PR_SET_CHILD_SUBREAPER, 1, ...)` in the parent process and correctly
234+
handle the implications of being a subreaper. Failing to do so may result in
235+
zombie processes being accumulated on your host.
236+
237+
These tasks are usually performed by a dedicated (and minimal) monitor process
238+
per-container. For the sake of comparison, other runtimes such as LXC do not
239+
have an equivalent detached mode and instead integrate this monitor process
240+
into the container runtime itself -- this has several tradeoffs, and runc has
241+
opted to support delegating the monitoring responsibility to the parent process
242+
through this detached mode.
243+
231244
#### Detached Pass-Through ####
232245

233246
In detached mode, pass-through actually does what it says on the tin -- the

0 commit comments

Comments
 (0)