[Zope3-dev] How to shutdown Zope3 gracefully?

Tim Peters tim.peters at gmail.com
Tue Jul 19 18:39:54 EDT 2005


[Tim Peters]
>> 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()).

[Benji York]
> All very true.  I think you'll also agree that it doesn't pose any
> particular danger during development.

Yes.

...

>> Well, the Z3 Windows Service shutdown code isn't wholly safe, ditto
>> Ctrl+Break

> If you're referring to the fact that Python's shutdown code (including
> calling atexit registered functions) don't get run in those instances,
> then I would agree that it "isn't wholly safe".

In part I was, but not mostly:  the C runtime libraries don't get a
chance to clean up either.  In particular, it doesn't help that
FileStorage "writes each transaction to disk" if the data is actually
just sitting in some internal C library I/O buffer and the C library
doesn't get a chance to flush internal buffers at shutdown time. 
FileStorage does a sync() call on the file descriptor after each
transaction to try to minimize the chance of problems like that, but
the effect of sync() doesn't seem well-defined on Windows.

> I'd also say that it isn't very smart to do that in a production
> environment, but we're talking about development, and I don't see a
> problem there (and haven't yet, as that's how I always shut down Zope 3
> on Windows)

What is?  Ctrl-C, Ctrl-Break, or pulling the power cord <wink>?


More information about the Zope3-dev mailing list