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

fix: Prevent Gunicorn child workers hangup #1493

Merged
merged 1 commit into from
Nov 2, 2023
Merged

fix: Prevent Gunicorn child workers hangup #1493

merged 1 commit into from
Nov 2, 2023

Conversation

ankush
Copy link
Member

@ankush ankush commented Nov 2, 2023

Problem:

  • Prerequisite: long running reqeust is going on.
  • bench restart is requested.
  • supervisord sends sigterm to gunicorn master process.
  • gunicorn passes it to all child workers and waits for graceful shutdown (30 seconds)
  • supervisord has no chill, and sends sigkill to master process in 10 seconds
  • gunicorn master proesss is dead, so now child workers will keep running until they complete request which can take a really long time.
  • This entire time the sites will be down.

image

image

Fix:

  • Explicitly encode default graceful_timeout in config - 30 seconds.
  • Make supervisor wait 10 more seconds for gunicorn to do its thing, then only send sigkill.

Detailed analysis: https://gameplan.frappe.cloud/g/engineering/projects/152/discussion/2523

Problem:

- Prerequisite: long running reqeust is going on.
- `bench restart` is requested.
- supervisord sends sigterm to gunicorn master process.
- gunicorn passes it to all child table and waits for graceful shutdown (30 seconds)
- supervisord has no chill, and sends sigkill to master process in 10 seconds
- gunicorn master proesss is dead, so now child workers will keep running until they complete request which can take a really long time.
- This entire time the sites will be down.

Fix:
- Explicitly encode default graceful_timeout in config - 30 seconds.
- Make supervisor wait 10 more seconds for gunicorn to do its thing, then only send sigkill.
Copy link

sonarcloud bot commented Nov 2, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@ankush ankush merged commit 52f7047 into develop Nov 2, 2023
15 checks passed
@ankush ankush deleted the timeout branch November 2, 2023 06:41
Copy link

github-actions bot commented Nov 2, 2023

🎉 This PR is included in version 5.19.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant