What is the correct way to properly shut down Zope 4?

waitress documentation seems to suggest Ctrl-C alias SIGINT.

Will SIGINT properly shut down Zope 4?

I never used something different.

Neither SIGINT nor SIGTERM cause a proper shutdown of a Plone WSGI server.
Both signals kill the main process but the serve.py process stays.

Are you sure there is a serve.py with WSGI? This sounds like a ZServer setup. Sorry I should have been more clear: This is not a question about Plone - it's about Zope 4 with the standard WSGI setup using waitress. I trust Michael with his answer that SIGINT is OK for that setup.

Plone 5.2, Python 3..this is WSGI only.

Sorry, probably partially OT, but talking about shutdown/kill vs. graceful shutdown.

In my experiences, it depends on specific WSGI server.

Waitress seems to me that lack this feature (https://github.com/Pylons/waitress/issues/198)

Bjoern works well for me, currently using SIGINT/SIGKILL instead of SIGTERM/SIGKILL previously provided by ZServer (https://github.com/jonashaag/bjoern/issues/91#issuecomment-493710529). Add stopsignal=INT on supervisord and works like a charm.

BTW. https://github.com/zopefoundation/Zope/pull/740 helps, but not mandatory, to do a better shutdown (released on last Zope).

OK now I'm unsure again. Are you telling me there is no way to shut down Zope 4 with waitress gracefully and I'm risking ZODB corruption every time I take it down (which is daily because: backups / memory leaks)?

@brunni IMHO no, I've never experienced that. There is no problem with DB transaction.

The problem is that with kill, and no "graceful shutdown", you probably interrupt response to a user. Gracefully shutdown, for me, means that you want to complete all serving requests before shutdown the server.

  1. the behavior that I have seen likely smells like a bug
  2. usually you start/stop an instance through the command script
  3. if you are running a Zope instances against a ZEO server then there should not be any ZODB corruption
  4. the ZODB should/is robust against unclean shutdowns...never seen any ZODB corruption related to that (YMMV)

Shit - runwsgi does not react to SIGINT or SIGQUIT - only to CTRL-C.

Andreas there is no command script - I'm talking about vanilla Zope 4 - not Plone.

Edit: It is standard shell behaviour to ignore SIGINT and SIGQUIT when stuff is run in the background. I'm using SIGHUP for now but this is all kinda embarassing....

One of my Zope instances is ignoring SIGHUP since last night. A hard restart with SIGTERM or a ZODB pack does not change this bevaviour. What should I do?

Looks like this is because the server was rebooted and SIGHUP is also ignored for processes started in the system startup scripts. This leaves SIGTERM - I'll use that.