[AIRFLOW-1885] Fix access of cmdline when a gunicorn workers becomes a zombie#2844
Closed
j16r wants to merge 1 commit intoapache:masterfrom
j16r:bugfix/poll_zombie_process
Closed
[AIRFLOW-1885] Fix access of cmdline when a gunicorn workers becomes a zombie#2844j16r wants to merge 1 commit intoapache:masterfrom j16r:bugfix/poll_zombie_process
j16r wants to merge 1 commit intoapache:masterfrom
j16r:bugfix/poll_zombie_process
Conversation
Contributor
|
Thanks for the contribution. Please follow the commit guidelines. |
Contributor
Author
|
@bolkedebruin yup! just working backwards... |
Codecov Report
@@ Coverage Diff @@
## master #2844 +/- ##
==========================================
+ Coverage 73.98% 74.03% +0.05%
==========================================
Files 160 160
Lines 12153 12161 +8
==========================================
+ Hits 8991 9003 +12
+ Misses 3162 3158 -4
Continue to review full report at Codecov.
|
Contributor
Author
|
|
If while trying to obtain a list of ready gunicorn workers, one of them becomes a zombie, psutil.cmdline returns [] (see here: https://github.com/giampaolo/psutil/blob/release-4.2.0/psutil/_pslinux.py#L1007) Boom: Traceback (most recent call last): File "/usr/local/bin/airflow", line 28, in <module> args.func(args) File "/usr/local/lib/python3.5/dist-packages/airflow/bin/cli.py", line 803, in webserver restart_workers(gunicorn_master_proc, num_workers) File "/usr/local/lib/python3.5/dist-packages/airflow/bin/cli.py", line 687, in restart_workers num_ready_workers_running = get_num_ready_workers_running(gunicorn_master_proc) File "/usr/local/lib/python3.5/dist-packages/airflow/bin/cli.py", line 663, in get_num_ready_workers_running proc for proc in workers File "/usr/local/lib/python3.5/dist-packages/airflow/bin/cli.py", line 664, in <listcomp> if settings.GUNICORN_WORKER_READY_PREFIX in proc.cmdline()[0] IndexError: list index out of range So ensure a cmdline is actually returned before doing the cmdline prefix check in ready_prefix_on_cmdline. Also: * Treat psutil.NoSuchProcess error as non ready worker * Add in tests for get_num_ready_workers_running
Acehaidrey
pushed a commit
to Acehaidrey/incubator-airflow
that referenced
this pull request
Jan 19, 2018
If while trying to obtain a list of ready gunicorn workers, one of them becomes a zombie, psutil.cmdline returns [] (see here: https://github.com/giampaolo/psutil/blob/release-4 .2.0/psutil/_pslinux.py#L1007) Boom: Traceback (most recent call last): File "/usr/local/bin/airflow", line 28, in <module> args.func(args) File "/usr/local/lib/python3.5/dist- packages/airflow/bin/cli.py", line 803, in webserver restart_workers(gunicorn_master_proc, num_workers) File "/usr/local/lib/python3.5/dist- packages/airflow/bin/cli.py", line 687, in restart_workers num_ready_workers_running = get_num_ready_workers_ running(gunicorn_master_proc) File "/usr/local/lib/python3.5/dist- packages/airflow/bin/cli.py", line 663, in get_num_ready_workers_running proc for proc in workers File "/usr/local/lib/python3.5/dist- packages/airflow/bin/cli.py", line 664, in <listcomp> if settings.GUNICORN_WORKER_READY_PREFIX in proc.cmdline()[0] IndexError: list index out of range So ensure a cmdline is actually returned before doing the cmdline prefix check in ready_prefix_on_cmdline. Also: * Treat psutil.NoSuchProcess error as non ready worker * Add in tests for get_num_ready_workers_running Closes apache#2844 from j16r/bugfix/poll_zombie_process
5 tasks
hougs
pushed a commit
to stitchfix/incubator-airflow
that referenced
this pull request
Jun 29, 2018
If while trying to obtain a list of ready gunicorn workers, one of them becomes a zombie, psutil.cmdline returns [] (see here: https://github.com/giampaolo/psutil/blob/release-4 .2.0/psutil/_pslinux.py#L1007) Boom: Traceback (most recent call last): File "/usr/local/bin/airflow", line 28, in <module> args.func(args) File "/usr/local/lib/python3.5/dist- packages/airflow/bin/cli.py", line 803, in webserver restart_workers(gunicorn_master_proc, num_workers) File "/usr/local/lib/python3.5/dist- packages/airflow/bin/cli.py", line 687, in restart_workers num_ready_workers_running = get_num_ready_workers_ running(gunicorn_master_proc) File "/usr/local/lib/python3.5/dist- packages/airflow/bin/cli.py", line 663, in get_num_ready_workers_running proc for proc in workers File "/usr/local/lib/python3.5/dist- packages/airflow/bin/cli.py", line 664, in <listcomp> if settings.GUNICORN_WORKER_READY_PREFIX in proc.cmdline()[0] IndexError: list index out of range So ensure a cmdline is actually returned before doing the cmdline prefix check in ready_prefix_on_cmdline. Also: * Treat psutil.NoSuchProcess error as non ready worker * Add in tests for get_num_ready_workers_running Closes apache#2844 from j16r/bugfix/poll_zombie_process
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
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.
JIRA
https://issues.apache.org/jira/browse/AIRFLOW-1885
Description
If while trying to obtain a list of ready gunicorn workers, one of them
becomes a zombie, psutil.cmdline returns [] (see here:
https://github.com/giampaolo/psutil/blob/release-4.2.0/psutil/_pslinux.py#L1007)
Boom:
So ensure a cmdline is actually returned before doing the cmdline prefix
check in ready_prefix_on_cmdline.
Also treats psutil.NoSuchProcess error as non ready worker.
Tests
My PR adds 4 unit tests for the
get_num_ready_workers_runningfunction within cli.py, this module previously had no unit testing and I movedget_num_ready_workers_runninginto a higher scope in order to test it.Commits
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":
Passes
git diff upstream/master -u -- "*.py" | flake8 --diff