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
Request interrupted during graceful restarting due to the signal #1337
Comments
gunicorn calls |
If someone can suggest an action here, we can try to make a change, but I am unable to decipher what you this issue is asking for. Gunicorn already uses Furthermore, while these solutions may not work for every platform and every Python version, we plan to overhaul the inter-process communication for the next major iteration of Gunicorn. Is there any action that should be taken on this issue or can it be closed? |
Hi @tilgovi . And thanks for a fine framework. I think the issue here is that worker processes will receive SIGINT/SIGTERM and simply do a I have reproduced a similar issue here: https://github.com/ivarref/gunicorn-swarm Correct me if I'm incorrect. |
Is this different from what you see? Can someone tell me what Gunicorn version, OS, Python version, and worker class they see interruptions on? As far as I know, graceful shutdown works on every worker type we ship on Py2.7 and Py3.4 on Linux. I believe I was testing 3.4 and not 3.5 last time I tried. |
Hi @tilgovi and thanks for the fast reply. Let me focus on I added some logging to
Isn't it strange that the worker keeps handling requests after the server socket has been closed? The line Here is a fork of Some details of my system: @tilgovi What do you think? It looks strange to me that workers keep accepting new requests after the server socket is closed. But I'm no IPC/socket expert, so I may very well have missed something. Thanks for your time. |
"Isn't it strange that the worker keeps handling requests after the server socket has been closed? This is the purpose of graceful shutdown. Ie let's try to finish the last connection accepted in the next Graceful timeout. If not then kill it: Maybe some connections are already in the backlog and were were accepted before the workers got the signal? |
Closing in favor of #1236 |
@xiaost's workaround is to block signals before processing a request and unblock after finishing the request.
Since it's a very common problem, is there any side effect that blocks us to handle the signal like this by default in Gunicorn?
The text was updated successfully, but these errors were encountered: