Z Object Publishing Environment

Search | Download | Documentation | Resources | Development




Join Zope.org
Log in

Developer Home
Get Involved!
The Fishbowl

 Zope Exits

Zope Newbies

Zope.org is sponsored by Digital Creations

Proposals Table of Contents Last edited by jim on Apr 4, 2001 6:02 pm
Zope Fish


Please Add comments at CleanSignalHandlingDiscussionx.


Tres Seaver


The "stop" script we ship with Zope uses (in non-Win32x platforms) a signal to down the Zope server processes:

   kill `cat /path/to/zope/var/Z2.pid`

The Zope process does nothing to arrange for handling this signal cleanly; hence, it gets taken down hard, without the opportunity to peform cleanup (e.g., the ZODB.FileStoragex doesn't get a chance to construct its index).

This proposal is related to the broader one of easing Zope administration -- see BetterStartStopScriptsx for that problem.

Proposed Solutions

Add signal handling to ZServerx, to permit more uniform control of the server from the command line. In particular:

  • Trap the signal.SIGTERM signal, and call the moral equivalent of manage_shutdown.

  • Trap the signal.SIGHUP signal, and call the moral equivalent of manage_restart.


This has been figured out and done for the ZEO storage server.

Risk Factors

  • Signal handling, especially in conjunction with threading, can be tricky:

    • Python, for instance, makes no guarantee that signal handlers will be called immediately (long running C-level extensions can induce lag between signal delivery and dispatch to the handler.)

    • Signals during I/O can cause the I/O operation to fail with errno == errno.EITNTR; this is one of the platform-dependent areas of Python.

    • Python signals are not well-supported on Win32x; OTOH, this lack is mitigated by the fact that most "production" Zope servers on Win32x will be controlled through the Win32x Service Control Manager.

    • Do we have a way to test for specific flavors of Unix? If so, we might want only to enable this feature on the platforms we have tested it on.


  • Add code to install signal handlers to the appropriate spot in the mainline, z2.py (they have to be installed by the main thread); bracket this installation with a test of os.name.


  • Checkin to z2.py

  • Add documentation of signal usage to the ZopeAdministratorsGuidex (or its moral equivalent).

View source CleanSignalHandling
Advanced Actions / History
Visitor: Anonymous User
Jump to:
... by pagename prefix or search term.
For a plain search:
Privacy policy       Printable Page       Feedback about Zope.org

served by app2