-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Improve web server stopping #11734
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
Merged
Merged
Improve web server stopping #11734
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
potiuk
approved these changes
Oct 22, 2020
02e4244 to
92de256
Compare
michalmisiewicz
pushed a commit
to michalmisiewicz/airflow
that referenced
this pull request
Oct 30, 2020
szn
pushed a commit
to szn/airflow
that referenced
this pull request
Nov 1, 2020
This was referenced Nov 20, 2020
potiuk
added a commit
to potiuk/airflow
that referenced
this pull request
Mar 19, 2023
During refactoring of the internal API background test, it was found that the SIGKILL termination of gunicorn in case it was not responding to SIGTERM (introduced in apache#11734) has never been working properly. The code assumed that gunicorn_master_process was of the subprocess.Popen type and used .poll() method to check if the process is still running and it would issue sigkill in such case. However the Process we have there is a psutil.Process and it has no poll() method - instead we can use is_running() method, which has the added advantage that is_running() is also checking if the pid has not been reused by another process after terminating the original gunicorn. The result of it was this error: ``` AttributeError: 'Process' object has no attribute 'poll' ```
potiuk
added a commit
that referenced
this pull request
Mar 20, 2023
During refactoring of the internal API background test, it was found that the SIGKILL termination of gunicorn in case it was not responding to SIGTERM (introduced in #11734) has never been working properly. The code assumed that gunicorn_master_process was of the subprocess.Popen type and used .poll() method to check if the process is still running and it would issue sigkill in such case. However the Process we have there is a psutil.Process and it has no poll() method - instead we can use is_running() method, which has the added advantage that is_running() is also checking if the pid has not been reused by another process after terminating the original gunicorn. The result of it was this error: ``` AttributeError: 'Process' object has no attribute 'poll' ```
pierrejeambrun
pushed a commit
that referenced
this pull request
Mar 24, 2023
During refactoring of the internal API background test, it was found that the SIGKILL termination of gunicorn in case it was not responding to SIGTERM (introduced in #11734) has never been working properly. The code assumed that gunicorn_master_process was of the subprocess.Popen type and used .poll() method to check if the process is still running and it would issue sigkill in such case. However the Process we have there is a psutil.Process and it has no poll() method - instead we can use is_running() method, which has the added advantage that is_running() is also checking if the pid has not been reused by another process after terminating the original gunicorn. The result of it was this error: ``` AttributeError: 'Process' object has no attribute 'poll' ``` (cherry picked from commit fd2db88)
28 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
If we send signal
SIGTERM - 15several times to airflow webserver, then gunicorn can become defunct process and Airflow will not be able to handle this situation and wait in an endless loop. Re-sending the signal to Airflow will cause it to re-send the signalSIGTERM - 15to gunicorn (but it will not receive it anyway) and then re-enter the endless loop. As a result, Airflow can only be stopped by signalSIGKILL - -9.It is possible that it will fix some of the tests we have in quarantine.
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.