supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Gerrit Pape <pape@smarden.org>
Subject: Re: Adding a 'setup' phase to service startup?
Date: Mon, 7 Mar 2005 11:56:12 +0000	[thread overview]
Message-ID: <20050307115343.3584.qmail@786f5a78e3b7ba.315fe32.mid.smarden.org> (raw)
In-Reply-To: <slrnd1k7hn.j93.lars@flowers.house.oddbit.com>

On Mon, Feb 21, 2005 at 05:41:59PM +0000, Lars Kellogg-Stedman wrote:
> I was mulling over service dependencies yesterday, and I wonder if it would
> make sense to add a "setup" phase to runsv's service startup sequence.
> This would allow, for example, svwaitup to block while a service performed
> one time initialization.
> 
> Here I'm thinking particularly of long-running setup actions, such as
> database initialization or something.  The current solution -- waiting for
> a number of seconds and then crossing our fingers -- doesn't provide the
> level of control that runit provides in other areas.

Yes, true.  I don't consider svwaitup as the current solution, but as a
workaround.  The fix actually should be in the service daemons I think,
see http://smarden.org/runit/dependencies.html

> This would make the start sequence look like this:
[...]
> svwaitup() would block if a service was in the "setup" phase.  This should
> require only minor changes to runit -- introduce "runsv" to the "setup"
> script, and modify svwaitup, svwaitdown, and runsvstat to understand a new
> state value in the status file.

This doesn't eliminate the race condition, just lets it look a bit
better.

I'm still looking for examples why service dependencies, more than runit
currently provides, is needed.  What are these services that must be
started not before another service has been started and is available,
and that don't recognize the error if the service depended upon isn't
available?  How do these services behave on that error condition?,
shouldn't they log the error and fail?

What are these services that need to be taken down manually after a
service they depend upon became down?  How do they behave if a service
they need has been available on startup, but disappears while uptime?,
shouldn't they log the error and fail, or maybe retry?

What other problems are service dependencies meant to solve?

I'm aware of one example, the problem that service daemons that log
through syslog cannot know whether the syslog service is enabled, simply
because the corresponding unix functions return void.  To work around
this for services that cannot switch to the runit logging facility, I
added the socklog-check program to the socklog package.  This program
checks for a listener on (e.g.) /dev/log, and fails if the socket isn't
maintained; it can be added to the top of the run script with set -e or
as `socklog-check unix /dev/log || exit 1` to prevent the service from
being started in this case.

Thanks, Gerrit.


      parent reply	other threads:[~2005-03-07 11:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-21 17:41 Lars Kellogg-Stedman
2005-02-22  4:08 ` Dean Hall
2005-02-22 15:06   ` Thomas Schwinge
2005-02-23 20:07   ` Lars Kellogg-Stedman
2005-02-24  4:28     ` Dean Hall
2005-02-24  4:40     ` Dean Hall
2005-02-23 21:12 ` Stefan Karrmann
2005-03-07 11:56 ` Gerrit Pape [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050307115343.3584.qmail@786f5a78e3b7ba.315fe32.mid.smarden.org \
    --to=pape@smarden.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).