Skip to content
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

Terminate properly with signal TERM and INT #63

Closed
wants to merge 1 commit into from

Conversation

mardiros
Copy link

Before this commit, only the QUIT commit do
the cleanup correctly.
Gunicorn base worker call sys.exit(0) on TERM
and INT wich does not close the loop properly.

When running gunicorn in my terminal, terminate it with CTRL+C
or with "pkill gunicorn" should call the close method to properly
exit.

Before this commit, only the QUIT commit do
the cleanup correctly.
Gunicorn base worker call sys.exit(0) on TERM
and INT wich does not close the loop properly.
@fafhrd91
Copy link
Member

i still think aiohttp is wrong place to put this code. it should be part of gunicorn.

BTW close works with gunicorn master
https://github.com/benoitc/gunicorn/blob/master/gunicorn/workers/base.py#L127

@mardiros
Copy link
Author

OK, I am using the 0.18 version, didn't now about this change.

The base class of gunicorn does not have a close method, which I found usefull,
to clean his room (except gevent) so it doesn't really affect them.
But if we can't rely on that close method, it's not usefull at all.

I am happy to known that in the next version of gunicorn, the SIGTERM will be handle properly,
but the SIGQUIT will not call the close method anymore, and the SIGINT is still not working.

@fafhrd91
Copy link
Member

what is use case for those signals? you can not relay on SIGTERM, i saw different behavior depends on os. is SIGINT useful in production?

@mardiros
Copy link
Author

I currently want to delete amqp queues. I guess I should reconsider that.
To me, SIGINT isn't usesull for production, SIGTERM should be the default signal for terminate a daemon. I don't know if it's true on every unix.

@mardiros
Copy link
Author

I am going to override the aiohttp worker now.

https://github.com/mardiros/pyramid_asyncio/blob/master/pyramid_asyncio/worker.py

@mardiros mardiros closed this May 31, 2014
@fafhrd91
Copy link
Member

Just released gunicorn 0.19 has new aiohttp worker "gaiohttp"

@lock
Copy link

lock bot commented Oct 30, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 30, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants