This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 224285b6fc Revert "Remove custom signal handling in Triggerer 
(#23274)" (#24390)
224285b6fc is described below

commit 224285b6fcd433cf6257519f695d8d49feceebf2
Author: Jarek Potiuk <[email protected]>
AuthorDate: Mon Jun 13 19:29:31 2022 +0200

    Revert "Remove custom signal handling in Triggerer (#23274)" (#24390)
    
    This reverts commit 6bdbed6c43df3c5473b168a75c50e0139cc13e88.
---
 airflow/cli/commands/triggerer_command.py | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/airflow/cli/commands/triggerer_command.py 
b/airflow/cli/commands/triggerer_command.py
index 8bf4192680..82e7fde129 100644
--- a/airflow/cli/commands/triggerer_command.py
+++ b/airflow/cli/commands/triggerer_command.py
@@ -24,7 +24,7 @@ from daemon.pidfile import TimeoutPIDLockFile
 from airflow import settings
 from airflow.jobs.triggerer_job import TriggererJob
 from airflow.utils import cli as cli_utils
-from airflow.utils.cli import setup_locations, setup_logging, sigquit_handler
+from airflow.utils.cli import setup_locations, setup_logging, sigint_handler, 
sigquit_handler
 
 
 @cli_utils.action_cli
@@ -50,19 +50,7 @@ def triggerer(args):
                 job.run()
 
     else:
-        # There is a bug in CPython (fixed in March 2022 but not yet released) 
that
-        # makes async.io handle SIGTERM improperly by using async unsafe
-        # functions and hanging the triggerer receive SIGPIPE while handling
-        # SIGTERN/SIGINT and deadlocking itself. Until the bug is handled
-        # we should rather rely on standard handling of the signals rather than
-        # adding our own signal handlers. Seems that even if our signal handler
-        # just run exit(0) - it caused a race condition that led to the 
hanging.
-        #
-        # More details:
-        #   * https://bugs.python.org/issue39622
-        #   * https://github.com/python/cpython/issues/83803
-        #
-        # signal.signal(signal.SIGINT, sigint_handler)
-        # signal.signal(signal.SIGTERM, sigint_handler)
+        signal.signal(signal.SIGINT, sigint_handler)
+        signal.signal(signal.SIGTERM, sigint_handler)
         signal.signal(signal.SIGQUIT, sigquit_handler)
         job.run()

Reply via email to