benoitc/gunicorn — pull request #961 by wooparadog (2014-12-20 09:54:22+00:00)
Title: Close existing sockets in master process when stopping.

Previously, when `gunicorn` is told to restart, it'll signal
workers to stop listening for new connections. But listening
ports are still open in master process. This lets load balancer,
such as haproxy, think that this server is still up and dispatch
requests to this server. But because all workers have stopped
accepting new connections. New requests will block until timeout.
This is especially severe when conducting a restart in a setup with
long graceful-timeout setting, causing many requests to timeout.

This patch fix that by closing all `LISTENERS` in `stop` method of
`Arbitor`.