- rename LockFile.lock to acquire
- rename LockFile.unlock to release
- move the lockfile management in sepate functions inside the arbiter
- remove the "closed" argument from the socket.close method and add a new "destroy" function that will be called whent the socket can be unlinked (cal release)
- fix tests
This change add proper file locking to gunicorn. By default "gunicorn.lock" is created in the temporary directory when a unix socket is bound. In case someone want to fix the lock file path or use multiple gunicorn instance the "--lock-file" setting can be used to set the path of this file.
fix#1259
Killing ourself when using the `--reload` option trigger an infinite loop under some monitoring services like the one in pycharm and don't reload the file.
Instead set self.alive as False which will trigger later the worker exit. Note that if we want to force the exit we could also use sys.exit(0) .
fix#1129
releae often shoudl be our mantra. We have too much fixes in that release that
were waiting since a while. Let's start a month release (ore more) from now.
in python 3.5 the select is blocking when waiting for it which prevent quick
exit on SIGTERM.
The problem is described:
https://www.python.org/dev/peps/pep-0475/#backward-compatibility
This change fix it by listening for signal event on the worker pipe. Once an
event is triggered it will forcefully wake up the select and return.
fix#1256
The run loop has to change slightly to support graceful shutdown.
There is no way to interrupt a call to `futures.wait` so instead
the pattern, used by the async workers, is to sleep for only one
second at the most. The poll is extended to a one second timeout
to match.
Since threads are preemptively scheduled, it's possible that the
listener is closed when the request is actually handled. For this
reason it is necessary to slightly refactor the TConn class to store
the listening socket name. The name is checked once at the start of
the worker run loop.
Ref #922