From e3b0b1f91aae0d2ec50098595fd43b05e68b3758 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Fri, 8 Oct 2021 21:04:12 -0400 Subject: [PATCH 01/23] integral? that took me a while to figure out integral: "In mathematics, an integral assigns numbers to functions in a way that describes displacement, area, volume, and other concepts that arise by combining infinitesimal data." integer: an int type --- gunicorn/http/body.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gunicorn/http/body.py b/gunicorn/http/body.py index afde3685..aa1af2cb 100644 --- a/gunicorn/http/body.py +++ b/gunicorn/http/body.py @@ -18,7 +18,7 @@ class ChunkedReader(object): def read(self, size): if not isinstance(size, int): - raise TypeError("size must be an integral type") + raise TypeError("size must be an integer type") if size < 0: raise ValueError("Size must be positive.") if size == 0: From 76f8da24cbb992d168e01bda811452bcf3b8f5b3 Mon Sep 17 00:00:00 2001 From: benoitc Date: Fri, 17 Dec 2021 15:16:34 +0100 Subject: [PATCH 02/23] Revert "Log a warning when a worker was terminated due to a signal" This reverts commit b695b497b9b8e7351808848ab9e342219601742a. --- gunicorn/arbiter.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index 24ec3874..7ca2f6b7 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -526,12 +526,6 @@ class Arbiter(object): if exitcode == self.APP_LOAD_ERROR: reason = "App failed to load." raise HaltServer(reason, self.APP_LOAD_ERROR) - if os.WIFSIGNALED(status): - self.log.warning( - "Worker with pid %s was terminated due to signal %s", - wpid, - os.WTERMSIG(status) - ) worker = self.WORKERS.pop(wpid, None) if not worker: From cf3619f831a14baa9d3bda8a3aa589b9bf23eaf4 Mon Sep 17 00:00:00 2001 From: Kian-Meng Ang Date: Fri, 14 Jan 2022 23:34:02 +0800 Subject: [PATCH 03/23] Fix typos --- NOTICE | 2 +- docs/site/index.html | 2 +- docs/source/2012-news.rst | 2 +- docs/source/2013-news.rst | 6 +++--- docs/source/2014-news.rst | 4 ++-- docs/source/2019-news.rst | 2 +- docs/source/community.rst | 2 +- gunicorn/glogging.py | 2 +- gunicorn/workers/workertmp.py | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/NOTICE b/NOTICE index 8506656b..942a605d 100644 --- a/NOTICE +++ b/NOTICE @@ -86,4 +86,4 @@ OTHER DEALINGS IN THE SOFTWARE. util/unlink.py -------------- -backport frop python3 Lib/test/support.py +backport from python3 Lib/test/support.py diff --git a/docs/site/index.html b/docs/site/index.html index d7312d82..31545d68 100644 --- a/docs/site/index.html +++ b/docs/site/index.html @@ -118,7 +118,7 @@
  • Forum
  • Mailing list -

    Project maintenance guidelines are avaible on the wiki

    +

    Project maintenance guidelines are available on the wiki

    Irc

    The Gunicorn channel is on the Freenode IRC diff --git a/docs/source/2012-news.rst b/docs/source/2012-news.rst index 6ae37bfe..ce4f7cc4 100644 --- a/docs/source/2012-news.rst +++ b/docs/source/2012-news.rst @@ -75,7 +75,7 @@ Changelog - 2012 - fix tornado.wsgi.WSGIApplication calling error - **breaking change**: take the control on graceful reload back. - graceful can't be overrided anymore using the on_reload function. + graceful can't be overridden anymore using the on_reload function. 0.14.3 / 2012-05-15 ------------------- diff --git a/docs/source/2013-news.rst b/docs/source/2013-news.rst index 5f848e2c..eb8cf556 100644 --- a/docs/source/2013-news.rst +++ b/docs/source/2013-news.rst @@ -38,10 +38,10 @@ Changelog - 2013 - fix: give the initial global_conf to paster application - fix: fix 'Expect: 100-continue' support on Python 3 -New versionning: +New versioning: ++++++++++++++++ -With this release, the versionning of Gunicorn is changing. Gunicorn is +With this release, the versioning of Gunicorn is changing. Gunicorn is stable since a long time and there is no point to release a "1.0" now. It should have been done since a long time. 0.17 really meant it was the 17th stable version. From the beginning we have only 2 kind of @@ -49,7 +49,7 @@ releases: major release: releases with major changes or huge features added services releases: fixes and minor features added So from now we will -apply the following versionning ``.``. For example ``17.5`` is a +apply the following versioning ``.``. For example ``17.5`` is a service release. 0.17.4 / 2013-04-24 diff --git a/docs/source/2014-news.rst b/docs/source/2014-news.rst index 1a9af82b..3eec18fc 100644 --- a/docs/source/2014-news.rst +++ b/docs/source/2014-news.rst @@ -71,7 +71,7 @@ AioHttp worker Async worker ++++++++++++ -- fix :issue:`790`: StopIteration shouldn't be catched at this level. +- fix :issue:`790`: StopIteration shouldn't be caught at this level. Logging @@ -180,7 +180,7 @@ core - add: syslog logging can now be done to a unix socket - fix logging: don't try to redirect stdout/stderr to the logfile. - fix logging: don't propagate log -- improve logging: file option can be overriden by the gunicorn options +- improve logging: file option can be overridden by the gunicorn options `--error-logfile` and `--access-logfile` if they are given. - fix: don't override SERVER_* by the Host header - fix: handle_error diff --git a/docs/source/2019-news.rst b/docs/source/2019-news.rst index 771c28f0..28b69216 100644 --- a/docs/source/2019-news.rst +++ b/docs/source/2019-news.rst @@ -90,7 +90,7 @@ Changelog - 2019 - Simplify Paste Deployment documentation - Fix root logging: root and logger are same level. - Fixed typo in ssl_version documentation -- Documented systemd deployement unit examples +- Documented systemd deployment unit examples - Added systemd sd_notify support - Fixed typo in gthread.py - Added `tornado `_ 5 and 6 support diff --git a/docs/source/community.rst b/docs/source/community.rst index 249d82c5..e1676744 100644 --- a/docs/source/community.rst +++ b/docs/source/community.rst @@ -15,7 +15,7 @@ for 3 different purposes: * `Mailing list `_ : Discussion of Gunicorn development, new features and project management. -Project maintenance guidelines are avaible on the `wiki `_ +Project maintenance guidelines are available on the `wiki `_ . IRC diff --git a/gunicorn/glogging.py b/gunicorn/glogging.py index 08bc121a..6d80a3ac 100644 --- a/gunicorn/glogging.py +++ b/gunicorn/glogging.py @@ -275,7 +275,7 @@ class Logger(object): self.error_log.log(lvl, msg, *args, **kwargs) def atoms(self, resp, req, environ, request_time): - """ Gets atoms for log formating. + """ Gets atoms for log formatting. """ status = resp.status if isinstance(status, str): diff --git a/gunicorn/workers/workertmp.py b/gunicorn/workers/workertmp.py index 65bbe54f..cc79ecd6 100644 --- a/gunicorn/workers/workertmp.py +++ b/gunicorn/workers/workertmp.py @@ -28,7 +28,7 @@ class WorkerTmp(object): if cfg.uid != os.geteuid() or cfg.gid != os.getegid(): util.chown(name, cfg.uid, cfg.gid) - # unlink the file so we don't leak tempory files + # unlink the file so we don't leak temporary files try: if not IS_CYGWIN: util.unlink(name) From e5a97150c95d68551a3cd3a3ecf356dcd20b667c Mon Sep 17 00:00:00 2001 From: Krystian Date: Fri, 4 Feb 2022 05:11:51 +0800 Subject: [PATCH 04/23] fix chdir documentation typo (#2656) --- docs/source/settings.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/source/settings.rst b/docs/source/settings.rst index 4c8e9212..87400899 100644 --- a/docs/source/settings.rst +++ b/docs/source/settings.rst @@ -976,9 +976,11 @@ Set the ``SO_REUSEPORT`` flag on the listening socket. **Command line:** ``--chdir`` -**Default:** ``'/Users/chainz/Documents/Projects/gunicorn/docs'`` +**Default:** ``'.'`` -Change directory to specified directory before loading apps. +Change directory to specified directory before loading apps. + +Default is the current directory. .. _daemon: From 835a4fc42089d12b41bf1564844d7b518cc5e324 Mon Sep 17 00:00:00 2001 From: Brett Randall Date: Thu, 27 Jan 2022 16:03:13 +1100 Subject: [PATCH 05/23] Ensure fd 0 stdin --- gunicorn/util.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gunicorn/util.py b/gunicorn/util.py index a821e357..af414093 100644 --- a/gunicorn/util.py +++ b/gunicorn/util.py @@ -486,7 +486,10 @@ def daemonize(enable_stdio_inheritance=False): closerange(0, 3) fd_null = os.open(REDIRECT_TO, os.O_RDWR) + # PEP 446, make fd for /dev/null inheritable + os.set_inheritable(fd_null, True) + # expect fd_null to be always 0 here, but in-case not ... if fd_null != 0: os.dup2(fd_null, 0) @@ -494,13 +497,17 @@ def daemonize(enable_stdio_inheritance=False): os.dup2(fd_null, 2) else: - fd_null = os.open(REDIRECT_TO, os.O_RDWR) - # Always redirect stdin to /dev/null as we would # never expect to need to read interactive input. + os.close(0) + + fd_null = os.open(REDIRECT_TO, os.O_RDWR) + # PEP 446, make fd for /dev/null inheritable + os.set_inheritable(fd_null, True) + + # expect fd_null to be always 0 here, but in-case not ... if fd_null != 0: - os.close(0) os.dup2(fd_null, 0) # If stdout and stderr are still connected to From eedc3a38b66b4c5a5ae975baefdc9894288294e4 Mon Sep 17 00:00:00 2001 From: Brett Randall Date: Sun, 30 Jan 2022 17:58:52 +1100 Subject: [PATCH 06/23] Refactoring: common stdin Date: Mon, 31 Jan 2022 07:18:45 +1100 Subject: [PATCH 07/23] Revert "Refactoring: common stdin Date: Mon, 31 Jan 2022 07:26:26 +1100 Subject: [PATCH 08/23] Undo changes that make -R branch logic behave the same as non -R branch, that is, to close(0) and open /dev/null as fd=0 instead of fd=3. (Partially) Revert "Ensure fd 0 stdin Date: Mon, 7 Feb 2022 07:39:34 +1100 Subject: [PATCH 09/23] Updated THANKS. --- THANKS | 1 + 1 file changed, 1 insertion(+) diff --git a/THANKS b/THANKS index 2b226f35..cc48fa5d 100644 --- a/THANKS +++ b/THANKS @@ -109,6 +109,7 @@ Kyle Mulka Lars Hansson Leonardo Santagada Levi Gross +licunlong Łukasz Kucharski Mahmoud Hashemi Malthe Borch From a16b8975a921287d6d203a58dbadd8be182eda4f Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 2 Nov 2021 19:57:35 +0100 Subject: [PATCH 10/23] GitHub Action to run tox Because Travis CI seems to be on vacation... https://travis-ci.org/github/benoitc/gunicorn --- .github/workflows/tox.yml | 42 +++++++++++++++++++++++++++++++++ appveyor.yml | 34 ++++++++++++++++---------- tests/workers/test_geventlet.py | 5 ++++ tox.ini | 9 +++---- 4 files changed, 73 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/tox.yml diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml new file mode 100644 index 00000000..611a0938 --- /dev/null +++ b/.github/workflows/tox.yml @@ -0,0 +1,42 @@ +name: tox +on: [push, pull_request] +jobs: + tox-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - run: pip install --upgrade pip + - run: tox -e lint + + tox-docs-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - run: pip install --upgrade pip + - run: tox -e docs-lint + + tox-pycodestyle: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - run: pip install --upgrade pip + - run: tox -e pycodestyle + + tox: + strategy: + fail-fast: false + matrix: # All OSes pass except Windows because tests need Unix-only fcntl, grp, pwd, etc. + os: [ubuntu-latest] # [macos-latest, ubuntu-latest, windows-latest] + python: ['3.10'] # ['3.6', '3.7', '3.8', '3.9', '3.10', 'pypy-3.7'] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + - run: pip install --upgrade pip + - run: pip install tox + - run: tox -e py diff --git a/appveyor.yml b/appveyor.yml index 0bcf6c6c..5eb48e9c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,17 +2,23 @@ version: '{branch}.{build}' environment: matrix: - TOXENV: lint - PYTHON: "C:\\Python37-x64" - - TOXENV: py35 - PYTHON: "C:\\Python35-x64" - - TOXENV: py36 - PYTHON: "C:\\Python36-x64" - - TOXENV: py37 - PYTHON: "C:\\Python37-x64" - - TOXENV: py38 PYTHON: "C:\\Python38-x64" - - TOXENV: py39 - PYTHON: "C:\\Python39-x64" + - TOXENV: docs-lint + PYTHON: "C:\\Python38-x64" + - TOXENV: pycodestyle + PYTHON: "C:\\Python38-x64" + # Windows is not ready for testing!!! + # Python's fcntl, grp, pwd, os.geteuid(), and socket.AF_UNIX are all Unix-only. + #- TOXENV: py35 + # PYTHON: "C:\\Python35-x64" + #- TOXENV: py36 + # PYTHON: "C:\\Python36-x64" + #- TOXENV: py37 + # PYTHON: "C:\\Python37-x64" + #- TOXENV: py38 + # PYTHON: "C:\\Python38-x64" + #- TOXENV: py39 + # PYTHON: "C:\\Python39-x64" matrix: allow_failures: - TOXENV: py35 @@ -20,11 +26,13 @@ matrix: - TOXENV: py37 - TOXENV: py38 - TOXENV: py39 -init: SET "PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" +init: + - SET "PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" install: - pip install tox -build: off -test_script: tox +build: false +test_script: + - tox cache: # Not including the .tox directory since it takes longer to download/extract # the cache archive than for tox to clean install from the pip cache. diff --git a/tests/workers/test_geventlet.py b/tests/workers/test_geventlet.py index 815dcec3..030505a6 100644 --- a/tests/workers/test_geventlet.py +++ b/tests/workers/test_geventlet.py @@ -2,6 +2,11 @@ # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. +import pytest + +@pytest.mark.xfail( + reason="TypeError: cannot set 'is_timeout' of immutable type 'TimeoutError'" +) def test_import(): __import__('gunicorn.workers.geventlet') diff --git a/tox.ini b/tox.ini index 6000eb61..64bec90d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,16 +1,17 @@ [tox] -envlist = py35, py36, py37, py38, py39, pypy3, lint +envlist = py35, py36, py37, py38, py39, py310, pypy3, lint, docs-lint, pycodestyle skipsdist = True [testenv] usedevelop = True -commands = py.test --cov=gunicorn {posargs} +commands = pytest --cov=gunicorn {posargs} deps = -rrequirements_test.txt [testenv:lint] commands = pylint -j0 \ + --disable=consider-using-f-string,consider-using-from-import,consider-using-with,deprecated-method,unspecified-encoding \ gunicorn \ tests/test_arbiter.py \ tests/test_config.py \ @@ -46,5 +47,5 @@ deps = pycodestyle [pycodestyle] -max-line-length = 120 -ignore = E129,W503,W504,W606 +max-line-length = 127 +ignore = E122,E126,E128,E129,E226,E302,E303,E501,E722,E741,W291,W293,W503,W504,W606 From f587bfaf0f76b4cb7fd27c9d3c714c5622048d35 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 3 Nov 2021 16:17:45 +0100 Subject: [PATCH 11/23] GitHub Action to run tox --- .github/workflows/tox.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 611a0938..ca0cb26f 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -7,6 +7,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - run: pip install --upgrade pip + - run: pip install tox - run: tox -e lint tox-docs-lint: @@ -15,6 +16,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - run: pip install --upgrade pip + - run: pip install tox - run: tox -e docs-lint tox-pycodestyle: @@ -23,6 +25,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - run: pip install --upgrade pip + - run: pip install tox - run: tox -e pycodestyle tox: From 1feb7c59a227ca18851914df529543acb8b7f8b4 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 4 Feb 2022 14:43:38 +0100 Subject: [PATCH 12/23] Revert the xfail for Python 3.10 --- tests/workers/test_geventlet.py | 5 ----- tox.ini | 2 -- 2 files changed, 7 deletions(-) diff --git a/tests/workers/test_geventlet.py b/tests/workers/test_geventlet.py index 030505a6..815dcec3 100644 --- a/tests/workers/test_geventlet.py +++ b/tests/workers/test_geventlet.py @@ -2,11 +2,6 @@ # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. -import pytest - -@pytest.mark.xfail( - reason="TypeError: cannot set 'is_timeout' of immutable type 'TimeoutError'" -) def test_import(): __import__('gunicorn.workers.geventlet') diff --git a/tox.ini b/tox.ini index 64bec90d..4ee13435 100644 --- a/tox.ini +++ b/tox.ini @@ -11,7 +11,6 @@ deps = [testenv:lint] commands = pylint -j0 \ - --disable=consider-using-f-string,consider-using-from-import,consider-using-with,deprecated-method,unspecified-encoding \ gunicorn \ tests/test_arbiter.py \ tests/test_config.py \ @@ -48,4 +47,3 @@ deps = [pycodestyle] max-line-length = 127 -ignore = E122,E126,E128,E129,E226,E302,E303,E501,E722,E741,W291,W293,W503,W504,W606 From eaebf6d72bbdc43a9a16a704f5e66050d57c06f2 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 4 Feb 2022 14:48:24 +0100 Subject: [PATCH 13/23] Revert the xfail for Python 3.10 --- tox.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 4ee13435..196bac39 100644 --- a/tox.ini +++ b/tox.ini @@ -46,4 +46,5 @@ deps = pycodestyle [pycodestyle] -max-line-length = 127 +max-line-length = 120 +ignore = E129,W503,W504,W606 From 80a62afc1e410f92edf451cc7e7469925e46378c Mon Sep 17 00:00:00 2001 From: Brett Randall Date: Mon, 7 Feb 2022 08:43:10 +1100 Subject: [PATCH 14/23] Updated THANKS. --- THANKS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/THANKS b/THANKS index cc48fa5d..11713497 100644 --- a/THANKS +++ b/THANKS @@ -39,6 +39,7 @@ Chris Adams Chris Forbes Chris Lamb Chris Streeter +Christian Clauss Christoph Heer Christos Stavrakakis CMGS @@ -103,6 +104,7 @@ Konstantin Kapustin kracekumar Kristian Glass Kristian Øllegaard +Krystian Krzysztof Urbaniak Kyle Kelley Kyle Mulka From 19fb762bd523cce7fd05cb4f72166eaf682b677a Mon Sep 17 00:00:00 2001 From: Brett Randall Date: Mon, 7 Feb 2022 13:24:50 +1100 Subject: [PATCH 15/23] Split main tox test build and linters into two workflows. --- .github/workflows/lint.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/tox.yml | 27 --------------------------- 2 files changed, 29 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..e2a6225e --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,29 @@ +name: lint +on: [push, pull_request] +jobs: + tox-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - run: pip install --upgrade pip + - run: pip install tox + - run: tox -e lint + + tox-docs-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - run: pip install --upgrade pip + - run: pip install tox + - run: tox -e docs-lint + + tox-pycodestyle: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - run: pip install --upgrade pip + - run: pip install tox + - run: tox -e pycodestyle diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index ca0cb26f..f6199e20 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -1,33 +1,6 @@ name: tox on: [push, pull_request] jobs: - tox-lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - run: pip install --upgrade pip - - run: pip install tox - - run: tox -e lint - - tox-docs-lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - run: pip install --upgrade pip - - run: pip install tox - - run: tox -e docs-lint - - tox-pycodestyle: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - run: pip install --upgrade pip - - run: pip install tox - - run: tox -e pycodestyle - tox: strategy: fail-fast: false From 71d6388f0129f268a14c2cf587c74b966aaa9cce Mon Sep 17 00:00:00 2001 From: Brett Randall Date: Mon, 7 Feb 2022 13:40:12 +1100 Subject: [PATCH 16/23] Replaced Travis CI badge with 2x gh actions badges for test and lint --- README.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index a6a27b85..569f9db4 100644 --- a/README.rst +++ b/README.rst @@ -9,9 +9,13 @@ Gunicorn :alt: Supported Python versions :target: https://pypi.python.org/pypi/gunicorn -.. image:: https://travis-ci.org/benoitc/gunicorn.svg?branch=master +.. image:: https://github.com/benoitc/gunicorn/actions/workflows/tox.yml/badge.svg :alt: Build Status - :target: https://travis-ci.org/benoitc/gunicorn + :target: https://github.com/benoitc/gunicorn/actions/workflows/tox.yml + +.. image:: https://github.com/benoitc/gunicorn/actions/workflows/lint.yml/badge.svg + :alt: Lint Status + :target: https://github.com/benoitc/gunicorn/actions/workflows/lint.yml 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 From 99447b08271a5eb74485c88ce36e85f2c463a99d Mon Sep 17 00:00:00 2001 From: usr3 <50021155+usr3@users.noreply.github.com> Date: Sun, 13 Mar 2022 14:41:33 +0530 Subject: [PATCH 17/23] Fix typo in deploy.rst --- docs/source/deploy.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/deploy.rst b/docs/source/deploy.rst index 43bad9a8..809739f2 100644 --- a/docs/source/deploy.rst +++ b/docs/source/deploy.rst @@ -216,7 +216,7 @@ A tool that is starting to be common on linux systems is Systemd_. It is a system services manager that allows for strict process management, resources and permissions control. -Below are configurations files and instructions for using systemd to create +Below are configuration files and instructions for using systemd to create a unix socket for incoming Gunicorn requests. Systemd will listen on this socket and start gunicorn automatically in response to traffic. Later in this section are instructions for configuring Nginx to forward web traffic From cc3238c6ff5887919fdc9524f690275681970021 Mon Sep 17 00:00:00 2001 From: DwarfMaster Date: Sun, 13 Mar 2022 17:16:32 +0100 Subject: [PATCH 18/23] Prevent unnecessary setuid call --- gunicorn/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gunicorn/util.py b/gunicorn/util.py index fb844c18..c2681154 100644 --- a/gunicorn/util.py +++ b/gunicorn/util.py @@ -145,7 +145,7 @@ def set_owner_process(uid, gid, initgroups=False): elif gid != os.getgid(): os.setgid(gid) - if uid: + if uid and uid != os.getuid(): os.setuid(uid) From 7d8f68c1a78a17dc4c53b157937957d7320161ee Mon Sep 17 00:00:00 2001 From: "Hazh. M. Adam" Date: Mon, 4 Apr 2022 12:27:55 +0800 Subject: [PATCH 19/23] Solving issue #2692 ValueError: count must be a positive integer (got 0) --- gunicorn/http/wsgi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gunicorn/http/wsgi.py b/gunicorn/http/wsgi.py index 478677f4..0fcff5a2 100644 --- a/gunicorn/http/wsgi.py +++ b/gunicorn/http/wsgi.py @@ -371,8 +371,8 @@ class Response(object): if self.is_chunked(): chunk_size = "%X\r\n" % nbytes self.sock.sendall(chunk_size.encode('utf-8')) - - self.sock.sendfile(respiter.filelike, count=nbytes) + if nbytes > 0: + self.sock.sendfile(respiter.filelike, count=nbytes) if self.is_chunked(): self.sock.sendall(b"\r\n") From f186fa3a27b55ff7b8517bade61aa453267c4643 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Fri, 22 Apr 2022 15:33:11 +0200 Subject: [PATCH 20/23] Make loggers function atomic Fixes https://github.com/benoitc/gunicorn/issues/2784: ``` Traceback (most recent call last): File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker worker.init_process() File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/uvicorn/workers.py", line 66, in init_process super(UvicornWorker, self).init_process() File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/gunicorn/workers/base.py", line 116, in init_process self.log.close_on_exec() File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/gunicorn/glogging.py", line 381, in close_on_exec for log in loggers(): File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/gunicorn/glogging.py", line 94, in loggers return [logging.getLogger(name) for name in existing] File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/gunicorn/glogging.py", line 94, in return [logging.getLogger(name) for name in existing] RuntimeError: dictionary changed size during iteration ``` --- gunicorn/glogging.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gunicorn/glogging.py b/gunicorn/glogging.py index 6d80a3ac..fec25a10 100644 --- a/gunicorn/glogging.py +++ b/gunicorn/glogging.py @@ -90,7 +90,7 @@ CONFIG_DEFAULTS = dict( def loggers(): """ get list of all loggers """ root = logging.root - existing = root.manager.loggerDict.keys() + existing = list(root.manager.loggerDict.keys()) return [logging.getLogger(name) for name in existing] From 1754d33e4add5d3234f1f5b22363bd5868ae0dd4 Mon Sep 17 00:00:00 2001 From: pylipp Date: Tue, 24 May 2022 15:39:07 +0200 Subject: [PATCH 21/23] Add Python 3.10 classifier Upon pushing to PyPI, the badge on top of the readme should automatically update --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index fb220d90..bffbb24e 100644 --- a/setup.py +++ b/setup.py @@ -26,6 +26,7 @@ CLASSIFIERS = [ 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3 :: Only', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', From 7ef281fa0388fb8ea2556a262f8e65dd2b69f20f Mon Sep 17 00:00:00 2001 From: David Moreau Simard Date: Sun, 29 May 2022 19:15:40 -0400 Subject: [PATCH 22/23] readme: IRC channel has moved to libera.chat There was a bit of drama with the freenode network and most channels have since migrated to libera.chat which is somewhat a spiritual successor. --- README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 569f9db4..fe9523b9 100644 --- a/README.rst +++ b/README.rst @@ -22,7 +22,7 @@ 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_. +Feel free to join us in `#gunicorn`_ on `Libera.chat`_. Documentation ------------- @@ -69,6 +69,6 @@ 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/ +.. _`#gunicorn`: https://web.libera.chat/?channels=#gunicorn +.. _`Libera.chat`: https://libera.chat/ .. _LICENSE: https://github.com/benoitc/gunicorn/blob/master/LICENSE From 4dff334f18ea7e75ce106d129fe5f75362137154 Mon Sep 17 00:00:00 2001 From: Roffild Date: Tue, 5 Jul 2022 14:43:43 +0300 Subject: [PATCH 23/23] fix LevelLog in Arbiter.run() --- gunicorn/arbiter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index 7ca2f6b7..0e705075 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -230,8 +230,8 @@ class Arbiter(object): except SystemExit: raise except Exception: - self.log.info("Unhandled exception in main loop", - exc_info=True) + self.log.error("Unhandled exception in main loop", + exc_info=True) self.stop(False) if self.pidfile is not None: self.pidfile.unlink()