interpreter crashes
Barry A. Warsaw
barry at zope.com
Mon Oct 29 01:40:59 EST 2001
>>>>> "MvL" == Martin von Loewis <loewis at informatik.hu-berlin.de> writes:
MvL> If you want to guarantee the service even in case of crashes
MvL> (which may not necessarily be core dumps, but could also be
MvL> uncaught exceptions), I'd recommend to put a super-simple
MvL> watch daemon along with service; if the service stops, the
MvL> daemon should restart it. In the service itself, assume it
MvL> will run forever (until told to shut down from the outside).
FWIW, I've implemented essentially this in Mailman 2.1, which will use
a long-running qrunner daemon instead of a one-shot, cron-invoked
qrunner (although there are plans to optionally provide the latter for
obscure reasons not relevant here).
To do it right isn't completely trivial, but it isn't that hard
either. Some of the things you need to deal with include: avoiding
inflooping on crash-restarts when the service your watching has a bug
in it (not uncommon when you're developing new software), adding
fail-safe exits, what happens if the watcher dies, passing resource
ownership across forks, properly doing the "Steven's Recipe for Daemon
Creation", etc. Mailman's also got some other interesting issues to
deal with such as lock refreshing and resource cleanup on exit.
Anybody interested should look in Mailman 2.1's cvs on SourceForge,
specifically the bin/mailmanctl and bin/qrunner scripts. So far, the
seem pretty solid, but they've only seen test mailing list traffic so
far. They shouldn't be hard to adapt to other Python daemon programs,
and are liberally commented.
Cheers,
-Barry
More information about the Python-list
mailing list