[Adam Groszer]
>>> Or, a better question: how to stop Zope3 cleanly (and when possible
>>> quickly, for development sessions)?

[Tim Peters]
>> Sorry, no idea here.  Anyone else?

[Benji York]
> Control-C.

Adam is running on Windows.  Bring up Zope3 from a DOS box, and after
it's running hit Ctrl+C in the DOS box.  Nothing visible happens, and
the Python process keeps running, for up to 30 seconds.  Unsure why. 
Probably because it's sitting in a select() with a 30-second timeout,
and Ctrl+C doesn't interrupt that on Windows.  Ctrl+Break stops it
instantly, but then the C libraries don't get a chance to clean up
(like Unix kill -9).

The Windows Service shutdown code in Zope3 also does a "very hard
kill" (a Win32 TerminateProcess()).

Mark Hammond tried to fix the Windows Service shutdown code in Zope2,
and improve Windows Ctrl+C handling, but Zope3 doesn't have his new

> As I said above, there is no danger of corrupting data in a "stock"
> install.
> There *is* the possibility of having on-going interactions with external
> systems that need some sort of shutdown (eg. relational databases, etc).
>  In that case I would recommend the Python standard library module
> "atexit".
> In summary: It might be nice if Z3 closed file handles and waited for
> outstanding requests to be handled, but the current shutdown story is
> perfectly "safe".

Well, the Z3 Windows Service shutdown code isn't wholly safe, ditto
Ctrl+Break, and Ctrl+C has "surprising" behavior.  This:

>    from zope.app import zapi
>    from zope.app.applicationcontrol.interfaces import IServerControl
>    control = zapi.getUtility(IServerControl)
>    control.shutdown(0)

appears to be the same thing the Z3 "Shutdown server" button does, and
at least lets Python exit cleanly.
Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to