[Zope-Coders] extra-clean shutdown, signal handling

Guido van Rossum guido@python.org
Thu, 31 Oct 2002 10:49:37 -0500


> > Does anyone understand why
> > zdaemon does fork+fork+exec rather than just fork+fork?
> 
> I think this makes a difference in the following sequence:
> 
> 1. start zope, and wait a while
> 2. update the zope source
> 3. use the through-the-web 'restart' 
> 
> Zope will always use the original modules if they were imported
> before the first fork, and will pick up any changes to other modules
> that are only imported later. This could lead to using mismatched
> versions of modules for anyone working from cvs, or performing an
> online upgrade.
> 
> Below is a list of these early-imported modules. 
> 
> -1 for losing the exec, unless we can trim this list to only include
> stuff inside zdaemon.

Good point.  Why is all of this so friggin' complicated. :-(

I'd still like to lose the exec, because it's really confusing how it
works now (see the issue I reported earlier).  When running
ZEO/start.py, the imports are pretty reasonable (only zLOG and
zdaemon, and ZEO.util which can probably be avoided).

Alternatively, daemonizing should be done by a shell-level utility,
instead of trying to build it in.  I'd be happy (in fact, happier) if
we had an interface where if you said

  python ZEO/start.py <options>

it ran in the foreground and there was a separate tool

  daemonize python ZEO/start.py <options>

that ran its arguments as a daemon.

--Guido van Rossum (home page: http://www.python.org/~guido/)