Re: register runsvdir as subreaper

From: Kamil Cholewiński <harry666t_at_gmail.com>
Date: Mon, 30 Jan 2017 18:56:28 +0100

> I would like to ask if runsvdir could by default be defined as a
> subreaper on Linux. If it is already a PID 1, then there is no
> difference, but sometimes it is not. In that case when an orphan
> process happens under it, then it would be re-parented under the
> runsvdir, mimicking the behavior when runsvdir runs as a PID 1.

Reaping orphaned children should be the duty of PID 1. Adding
Linux-specific hacks to runit (or, for that matter, ANY other piece of
software) feels very wrong, especially since there's a way to solve your
problem correctly, without changing a single line in runit.

> runit is often used in Docker containers and sometimes you have a
> wrapper script which spawns runsvdir as a child. In that case runsvdir
> does not run as PID 1.

Read up on execve(2), and the exec builtin in the shell.

Also look up unit9/base[1][2], which is Debian + runit, done as
correctly as possible, with the absolutely minimal possible amount of
cruft. (Disclaimer: I'm the author.)

[1]: https://hub.docker.com/r/unit9/base/
[2]: https://github.com/unit9/docklabs/tree/master/base

<3,K.

On Mon, 30 Jan 2017, Mitar <mmitar_at_gmail.com> wrote:
> Hi!
>
> I would like to ask if runsvdir could by default be defined as a
> subreaper on Linux. If it is already a PID 1, then there is no
> difference, but sometimes it is not. In that case when an orphan
> process happens under it, then it would be re-parented under the
> runsvdir, mimicking the behavior when runsvdir runs as a PID 1.
>
> runit is often used in Docker containers and sometimes you have a
> wrapper script which spawns runsvdir as a child. In that case runsvdir
> does not run as PID 1.
>
> I have found a similar patch for Debian, but which requested this
> feature on runsv. I think that might be misused for making process who
> demonize in fact stay under runsv. Or maybe that is a future feature
> of runit, not sure, but that can be discussion for some other thread.
> I would like to ask that something similar to that patch is done for
> runsvdir for now:
>
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833048
>
> This would really make it easier to use runit inside Docker.
>
> A bit more about subreapers here:
>
> https://unix.stackexchange.com/questions/250153/what-is-a-subreaper-process
>
>
> Mitar
>
> --
> http://mitar.tnode.com/
> https://twitter.com/mitar_m
Received on Mon Jan 30 2017 - 17:56:28 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC