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

Gunicorn ignores signals #3168

Open
VladimirVisnovsky opened this issue Mar 19, 2024 · 0 comments
Open

Gunicorn ignores signals #3168

VladimirVisnovsky opened this issue Mar 19, 2024 · 0 comments
Assignees

Comments

@VladimirVisnovsky
Copy link

When running gunicorn with --preload flag, the running master worker ignores signals (TTIN, TTOUT, HUP, etc).

gunicorn -b 0.0.0.0:5000 --worker-class eventlet -w 3 --reload server.wsgi:app --graceful-timeout 10 --preload

For example sending TTIN signal kill -TTIN $master_pid does nothing as well as CTRL+C does not interrupt the server, only kills the workers. Is there a reason these commands do not work with --preload flag? Without the flag gunicorn functionality works (signals, ctrl+c) without any problem. Maybe there is a problem with Flask application and not in Gunicorn?

The whole idea behind usage of --preload flag in my case is the scheduler that I use in Flask application. I need to run some tasks in background but if I spawn more than one worker, the code gets forked and executed multiple times across each worker. In my mind when using --preload flag, the scheduler gets initialized and AFTER that workers get forked. With --preload flag scheduler works as expected with multiple workers but I am stuck with original problem (ignoring signals, etc.)

@benoitc benoitc self-assigned this Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants