Use s6-notifyoncheck to check for services startup readiness #1665
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Having a fixed startup order of services is necessary in case services depend on each other. To manage startup,
s6
is used and startup order is fixed by settingdependencies
. However, there is a difference between starting a service and a service being ready. So far, the existence of aPID
is used to check for a complete startup - but this is error prone and the existence of aPID
does not really guarantees readiness. Especiallyavahi
needs a long time before it will signal complete startup. Setting arbitrarysleep
times only mitigates the issue but does not solve it.Init services use the concept of
startup notifications
where the started service signals the supervisor when it's ready. Unfortunately,dbus
andavahi
do not use the startup notifications6
uses (see here). Buts6
offerss6-notifyoncheck
to poll for service readiness.Using a
check
script that polls the started service allows to signals6
when the service is ready. Neitherdbus
noravahi
offer a good check by themselves (avahi-daemon --check
only check if a daemon is running, but probably not if it's ready), so a workaround is used: as the services offer adbus
interface, this is used to check it the service is really ready.DBus check inspired by mobinmob/void-66-services#52