"minit" point of view

martin f krafft madduck at debian.org
Fri Aug 26 23:43:47 UTC 2005


Nice email, Erich. Thanks!

also sprach Erich Schubert <erich.schubert at gmail.com> [2005.08.26.1508 +0200]:
> - feedback to highlevel (e.g. dbus would be nice)

*Pretty* please with sugar on top, make this an add-on. Let's *not*
drag d-bus into the core. No no no.

> - a non-trivial integration obstacle is invoke-rc.d

With that, do you mean the floating state of services?

> Unfortunately, if a daemon forks into the background, this trick will
> not work. minit has a workaround for that: a helper that waits for the
> fork, then waits for the pidfile, and tells the supervision process
> the correct pid of the daemon.
> Part of the reason for "daemonizing" is to detach from the parent
> process - and this also happens here. So this hack works only if the
> supervision process is pid 1 - because pid 1 will become the parent of
> the "detached" process!

I envision some sort of table that keeps track of processes, such
that I can write in there that PID 1234 should be restarted if it
dies. Now, whether PID 1234 is a startup script of the detached
daemon, when init receives a SIGCHLD, it can consult the table to
decide on the next action.

> If you have startup scripts that try to start a service they depend
> on, eventually block while that service is starting, and fail if they
> don't start, you don't have to care for dependency resolution at all!
> Basically this is how topological sort works - start anywhere and wait
> for everything that needs to be in front of you.

Yes, and that would be the only sane implementation, if you ask me.
We must allow for the case in which a user boots to minimal mode,
then starts just a single service. The topological approach is the
only one that would guarantee that dependencies also get started.

FWIW: a topological sort is nothing more than a depth-first search
down the dependency links, where the action of marking a node
visited (black) is that of starting the corresponding daemon.
I don't think the grey state needs to be considered even in
parallelised mode.

> The only thing you need to pay attention to is loops - loops will
> easily block, and instead should fail.

These are trivially handled with the grey state.

> Another thing you might want to have is alternatives or
> "provides". these are trickier to handle, I guess it's best to
> have a "virtual" service for these that just tries to get one
> providing service up.

Not if there's some sort of registry for startup scripts. Packages
would register their services on install time.

Then again, are there really services we would use Provides for,
maybe apart from the MTA?

  - Why would I depend on just any web server? I will depend on the
    web server which I have configured.

  - Why would I depend on a database server? MySQL and PostgreSQL
    are not compatible.

  - Why would I depend on a scheduler? A cron-replacement is not
    guaranteed to be compatible.

> minit solves this by having a flag "sync" for a service. This enables
> the following behaviours: 1. no other daemons will be started while
> the "sync"ed service is starting 2. minit will wait until the script
> is completed, then return

Why block other services in (1). It makes no sense to block service
startup sequences in disjoint vertex sets in the topological graph,
right?

> But I hope you got my point: you can depend on a background service
> being launched, or you can depend on a background service actually
> being available for requests...

Why would you ever depend on a background service being launched?
For me, it's always been the "running"/"ready" state, and nothing else.

> Certain bootup scripts (e.g. mounting filesystems) and some daemons,
> especially in foreground mode expect to be the only process writing to
> the console at a time.
> This means, they don't write complete lines and then flush etc.

There are trivial implementations for console output queues, though
none without drawbacks. My preferred approach would actually to get
rid of 'echo -n' and just do

- Starting apache2 web server...

[...]
+ Started apache2 web server.

or

! Error starting apache2 web server.

Then just flush out one line after the other. It's not going to be
hard to put something nicer on top of this when it all works.

Again, thanks for a very deep and informative email.

-- 
 .''`.     martin f. krafft <madduck at debian.org>
: :'  :    proud Debian developer and author: http://debiansystem.info
`. `'`
  `-  Debian - when you have better things to do than fixing a system
 
Invalid/expired PGP (sub)keys? Use subkeys.pgp.net as keyserver!
 
"the problem with america is stupidity. i'm not saying there should
 be a capital punishment for stupidity, but why don't we just take
 the safety labels off of everything and let the problem solve
 itself?"
                                                      -- seen on irc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature (GPG/PGP)
Url : http://lists.alioth.debian.org/pipermail/initscripts-ng-devel/attachments/20050827/aa5b03ae/attachment.pgp


More information about the initscripts-ng-devel mailing list