mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
When gunicorn --daemon daemonizes the process, prior to this change it was noted that in the general case (without -R / --enable-stdio-inheritance), when fd 0 was replaced with /dev/null, the dup2 copy is skipped, and per PEP 446 "Make newly created file descriptors non-inheritable", the result was a stdio fd </dev/null which was non-inheritable. As a result, any launched subprocess did not have an open 0/stdin fd, which can cause problems in some applications. This change retains the behaviour of opening /dev/null with fd 0, but adds a call to os.set_inheritable(..) to ensure the fd is inheritable. The -R branch had different logic but has now been standardised with the general case. It was previously opening /dev/null as fd 3 and the dup2() copy made it inheritable as fd 0. This branch now applies the same logic: open as fd 0 (i.e. after close(0)), then set_inheritable. As a result, an extra fd 3 </dev/null previously left open is no longer left open. Signed-off-by: Brett Randall <javabrett@gmail.com>
Gunicorn
--------
.. image:: https://img.shields.io/pypi/v/gunicorn.svg?style=flat
:alt: PyPI version
:target: https://pypi.python.org/pypi/gunicorn
.. image:: https://img.shields.io/pypi/pyversions/gunicorn.svg
:alt: Supported Python versions
:target: https://pypi.python.org/pypi/gunicorn
.. image:: https://travis-ci.org/benoitc/gunicorn.svg?branch=master
:alt: Build Status
:target: https://travis-ci.org/benoitc/gunicorn
Gunicorn 'Green Unicorn' is a Python WSGI HTTP Server for UNIX. It's a pre-fork
worker model ported from Ruby's Unicorn_ project. The Gunicorn server is broadly
compatible with various web frameworks, simply implemented, light on server
resource usage, and fairly speedy.
Feel free to join us in `#gunicorn`_ on Freenode_.
Documentation
-------------
The documentation is hosted at https://docs.gunicorn.org.
Installation
------------
Gunicorn requires **Python 3.x >= 3.5**.
Install from PyPI::
$ pip install gunicorn
Usage
-----
Basic usage::
$ gunicorn [OPTIONS] APP_MODULE
Where ``APP_MODULE`` is of the pattern ``$(MODULE_NAME):$(VARIABLE_NAME)``. The
module name can be a full dotted path. The variable name refers to a WSGI
callable that should be found in the specified module.
Example with test app::
$ cd examples
$ gunicorn --workers=2 test:app
Contributing
------------
See `our complete contributor's guide <CONTRIBUTING.md>`_ for more details.
License
-------
Gunicorn is released under the MIT License. See the LICENSE_ file for more
details.
.. _Unicorn: https://bogomips.org/unicorn/
.. _`#gunicorn`: https://webchat.freenode.net/?channels=gunicorn
.. _Freenode: https://freenode.net/
.. _LICENSE: https://github.com/benoitc/gunicorn/blob/master/LICENSE
Languages
Python
99.9%