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

Deployment on Heroku: add possibility to wait before terminating on SIGTERM #2884

Closed
PetrDlouhy opened this issue Oct 20, 2022 · 1 comment
Closed
Milestone

Comments

@PetrDlouhy
Copy link

I am using Gunicorn on Heroku in Docker container along with Nginx/Supervisor.

When Heroku scales down it first sends SIGTERM to all processes in the container and after 30 seconds it sends SIGKILL. I don't think, that I can change this behavior.

The correct behavior should be, that Nginx start terminate process first and stops accepting new requests and then Gunicorn starts it's termination. Otherwise the Heroku router sends new request to the terminating session (more described here: https://www.schneems.com/2019/07/12/puma-4-hammering-out-h13sa-debugging-story/).

The problem is that Heroku sends SIGTERM to all processes in the instance and the order of their termination is random.

I wonder if there could be added some possibility to wait defined number of seconds before the terminate process starts.

@PetrDlouhy
Copy link
Author

I have fixed this issue by patching Gunicorn this way: PetrDlouhy@1414112

@benoitc benoitc added this to the 21.0 release milestone May 7, 2023
@tilgovi tilgovi modified the milestones: 21.0, 22.0 Dec 28, 2023
@benoitc benoitc closed this as completed Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants