Skip to content

Conversation

@mik-laj
Copy link
Member

@mik-laj mik-laj commented Oct 21, 2020

If we send signal SIGTERM - 15 several 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 signal SIGTERM - 15 to gunicorn (but it will not receive it anyway) and then re-enter the endless loop. As a result, Airflow can only be stopped by signal SIGKILL - -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.

@boring-cyborg boring-cyborg bot added area:CLI area:webserver Webserver related Issues labels Oct 21, 2020
@mik-laj mik-laj requested review from ashb, kaxil and potiuk October 21, 2020 23:42
@mik-laj mik-laj marked this pull request as draft October 22, 2020 00:47
@mik-laj mik-laj marked this pull request as ready for review October 22, 2020 21:34
@mik-laj mik-laj merged commit e4c239f into apache:master Oct 22, 2020
@mik-laj mik-laj deleted the kiling-webserver branch October 22, 2020 21:36
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
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:CLI area:webserver Webserver related Issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants