How to gracefully shut down any WSGI server?

I experimented with several WSGI servers and could not find a way to gracefully close them. What I mean by graceful is that the server stops listening () for new requests, but finishes processing all connections that were accepted (). Then the server process ends.

So far I have spent some time with FAPWS, Cherrypy, Tornado and wsgiref. It seems that no matter what I do, some of the clients get "Connection reset by peer".

Can someone direct me to a WSGI server that will handle this correctly? Or do you know how to configure one of these servers for a clean shutdown? I think my next step is to mock up a simple HTTP server that does what I want.

+3
source share
1 answer

HTTPd has a predicate graceful-stopfor -k, which allows it to knock down all workers after their request is complete. mod_wsgi needs to be made it a WSGI container.

+4
source

All Articles