Hello,

Trying to use s6-rc, I have run into something that looks like a race condition between s6-rc-init and s6-svscan.

The context: as a concrete project to test s6-rc, I am using it to manage my X session, mainly for setup and supervising background tasks. So I want s6-svscan to be the "root" process of my X session.

My first try what this (roughly, variables are self-explanatory and "session" is my "root" bundle):

    background { s6-svscan -st 0 $S6_SCANDIR }
    if { s6-rc-init -c $S6_RC_COMPILED -l $S6_RC_LIVE $S6_SCANDIR }
    s6-rc $VERBOSE -l $S6_RC_LIVE -u change session

The issue is that once s6-rc ends, s6-svscan is "reparented" to init and I want to keep it attached the the login manager, so I refactored it to this:

    background {
        if { s6-rc-init -c $S6_RC_COMPILED -l $S6_RC_LIVE $S6_SCANDIR }
        s6-rc $VERBOSE -l $S6_RC_LIVE -u change session
    }
    s6-svscan -st 0 $S6_SCANDIR

Now it works as intended but s6-rc-init sometimes complains that $S6_SCANDIR is not supervised (i.e. s6-svscan is not ready). I think this could probably happen with the first solution too.

I have added "s6-sleep 1" before s6-rc-init to fix it, but I am wondering if there is an more elegant yet simple way to handle this ?

Regards,

--

Guillaume.

Reply via email to