[AIRFLOW-1235] In webserver, when gunicorn master dies, bubble up exc #3144
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
JIRA
Description
This catches the condition where gunicorn master process exits (usually due to a problem starting workers, e.g. SQL unavailable), but airflow isn't aware and the webserver just keeps running. This change will not leave airflow webserver in a hung state. It should crash all the way out, so that systemd/supervisord/docker/whatever init system can restart it.
This is a partial fix so we should not close out the Issue. We need to fix the underlying condition and make the airflow www app more robust (perhaps some retries) and potentially consider restarting gunicorn if it crashes.
Tests
This is a trivial change. The positive case is already covered in test coverage. I'm not totally sure how to cover the negative case (e.g. gunicorn dies). Mocking?
Commits
[X ] My commits all reference JIRA issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "How to write a good git commit message":
[X ] Passes
git diff upstream/master -u -- "*.py" | flake8 --diff