New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Requests in flight dropped during "graceful" shutdown #2529
Comments
On which system?
On Fri 26 Feb 2021 at 08:57, Angus McInnes ***@***.***> wrote:
*gunicorn version:* 20.0.4
*Expected behaviour:* after receiving SIGTERM, gunicorn should not accept
any new connections, but should finish handling requests on existing
connections (and respond with Connection: close so the client knows not
to send another request)
*Actual behaviour:* In some situations, during a graceful shutdown
gunicorn terminates a connection where a request has already been received,
without processing the request.
*To reproduce:*
1. Put this in app.py (it's an example copied from the docs, but with
time.sleep(10) added to it):
import time
def app(environ, start_response):
"""Simplest possible application object"""
data = b'Hello, World!\n'
status = '200 OK'
response_headers = [
('Content-type', 'text/plain'),
('Content-Length', str(len(data)))
]
time.sleep(10)
start_response(status, response_headers)
return iter([data])
1.
Run gunicorn app:app
2.
In two other terminals, run curl localhost:8000
3.
Before the curl commands have finished, send SIGTERM to the master
gunicorn process
You will see that one of the curl commands succeeds, and the other one
gives an error "Connection reset by peer".
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2529>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAADRIR4PBREANBQJD3KOVTTA5H67ANCNFSM4YH7IPLQ>
.
--
Sent from my Mobile
|
On Linux. |
Tracking this over in #1236. If you're using the threaded worker or the eventlet worker, this is a known issue. If not, can you please let us know what worker class you're using and we can keep this open to track that? |
old issue without any activity. closing it. feel free to open a new ticket if needed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
gunicorn version: 20.0.4
Expected behaviour: after receiving SIGTERM, gunicorn should not accept any new connections, but should finish handling requests on existing connections (and respond with
Connection: close
so the client knows not to send another request)Actual behaviour: In some situations, during a graceful shutdown gunicorn terminates a connection where a request has already been received, without processing the request.
To reproduce:
app.py
(it's an example copied from the docs, but withtime.sleep(10)
added to it):Run
gunicorn app:app
In two other terminals, run
curl localhost:8000
Before the
curl
commands have finished, send SIGTERM to the master gunicorn processYou will see that one of the
curl
commands succeeds, and the other one gives an error "Connection reset by peer".The text was updated successfully, but these errors were encountered: