Re: Bug in s6-svc -wr?

From: Colin Booth <colin_at_heliocat.net>
Date: Sat, 24 Apr 2021 17:33:05 +0000

On Sat, Apr 24, 2021 at 02:46:12PM +0200, Oliver Schad wrote:
> Hi everbody,
>
> if I call "s6-svc -wr servicedir", I get an error message:
>
> s6-svwait: usage: s6-svwait [ -U | -u | -d | -D ] [ -a | -o ] [ -t
> timeout ] servicedir...
>
> If I strace that, I find:
>
> execve("/usr/bin/s6-svwait", ["/usr/bin/s6-svwait", "-r", "--",
> "/run/s6-rc/scandir/nginx/"], [/* 19 vars */]) = 0
>
> But my s6-svwait doesn't support the option "-r". Is the option missing
> or the call broken?
>
In this case it's user error. s6-svc does different things depending on
if you give it an action in addition to a wait option or only a wait
option. `s6-svc -wX service' runs `s6-svwait -X service' whereas
`s6-svc -wX -Y service' runs `s6-svlisten1 -X service s6-svc -Y service'
instead. Unlike s6-svwait, s6-svlisten1 does have the -r option and will
behave mostly as expected.

The thing to keep in mind here is that the -wX options are for
synchronization only - `s6-svc -wu' does not actually tell the service
to go up. In the case of -wr/-wR, those are edge-triggered waits ("wait
for a service to transition from down to up") as opposed to the rest
which are level-triggered ("wait for the service to reach the up
status") and can be true immediately if the service is already at the
desired state. Ergo, it doesn't particularly make sense to wait on
restart events without also triggering a state change.

That said, the documentation could be more clear about -wr/-wR requiring
an action to differentiate them from the other wait states.

-- 
Colin Booth
Received on Sat Apr 24 2021 - 17:33:05 UTC

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