Re: Some suggestions about s6 and s6-rc

From: Casper Ti. Vector <caspervector_at_gmail.com>
Date: Sun, 20 Sep 2015 11:44:54 +0800

I just read your modification on the blurb page (commit e56e1294), and
found it somehow still lacking: in my experience, dependency is honoured
by OpenRC even with `rc_parallel' enabled; and more than that,
"readiness" (here defined as `exit 0' for a runscript) is also honoured:

> % head /etc/init.d/test.*
> ==> /etc/init.d/test.1 <==
> #!/sbin/openrc-run
> description="test 1"
> start() { sleep 2; }
> stop() { sleep 2; }
>
> ==> /etc/init.d/test.2 <==
> #!/sbin/openrc-run
> description="test 2"
> depend() { need test.1; }
> start() { sleep 2; }
> stop() { sleep 2; }

> % (
> sudo /etc/init.d/test.2 --quiet start & for i in $(seq 3);
> do sleep 1.5; echo "# test $i"; rc-status | grep test; done
> ) 2> /dev/null
> # test 1
> test.1 [ starting ]
> test.2 [ starting ]
> # test 2
> test.1 [ started ]
> test.2 [ starting ]
> # test 3
> test.1 [ started ]
> test.2 [ started ]

> % (
> sudo /etc/init.d/test.1 --quiet stop & for i in $(seq 3);
> do sleep 1.5; echo "# test $i"; rc-status | grep test; done
> ) 2> /dev/null
> # test 1
> test.1 [ stopping ]
> test.2 [ stopping ]
> # test 2
> test.1 [ stopping ]
> # test 3

I (after reading your response) also grepped the OpenRC source tree and
found the `if not rc_parallel then waitpid()' lines; a cursory guess is
that OpenRC uses some other (whether elegant or ugly) technique to
ensure dependency and "readiness" (`exit 0').

On Sat, Sep 19, 2015 at 02:26:44PM +0200, Laurent Bercot wrote:
> Grepping the current OpenRC git for "parallel" shows only a few instances
> of rc_parallel use; it seems to be used to defer waitpid() calls,
> which means OpenRC will be able to start/stop services without waiting
> for the exit code of previous invocations.
>
> This very much looks like an addition as an afterthought, not as an
> inherently parallel design. Unless I'm mistaken, there is no check for
> readiness; in the serial case, readiness is considered achieved when the
> invoked program exits. Using rc_parallel seems to defeat that design and
> possibly break service ordering: in other words, it is a hack that will
> only work if you're lucky, and goes contrary to the mechanics of OpenRC
> in the first place.
> Unfortunately, since most services get ready quickly enough and the
> Linux scheduler isn't retarded, problems rarely occur, as you have
> experienced; so it is not entirely obvious that rc_parallel is broken -
> but broken it is, and broken it will be unless the whole OpenRC engine
> is redesigned.
>
> You can't add parallel service start/stop as an afterthought. It has to
> be included in the design. OpenRC is a good serial rc system, but it's
> not a parallel rc system by any means.

-- 
My current OpenPGP key:
4096R/0xE18262B5D9BF213A (expires: 2017.1.1)
D69C 1828 2BF2 755D C383 D7B2 E182 62B5 D9BF 213A
Received on Sun Sep 20 2015 - 03:44:54 UTC

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