The GitHub Actions job "Tests (AMD)" on 
airflow.git/fix/signal-propagation-on-kill has succeeded.
Run started by GitHub user andreahlert (triggered by andreahlert).

Head commit for run:
0880eb031720efbb664fcb60b6138fee1a7be6fd / AndrĂ© Ahlert <[email protected]>
Forward termination signals from supervisor to task subprocess

When a Kubernetes worker pod receives SIGTERM (spot interruption, scaling
down, rolling update), the signal is delivered to the supervisor process
(PID 1 in the container). The supervisor has no signal handler installed
and exits with default behavior, leaving the task subprocess orphaned
without ever calling the operator's `on_kill()` hook. Spawned resources
(pods, subprocesses, etc.) are never cleaned up.

The task subprocess already has a SIGTERM handler registered in
`task_runner.py` that calls `on_kill()`, but the signal never reaches it
because the supervisor process terminates first.

Install SIGTERM/SIGINT signal handlers in `ActivitySubprocess.wait()`
that forward the received signal to the task subprocess via `os.kill()`.
The child's existing handler then calls `on_kill()` as expected,
restoring the Airflow 2 behavior. Handlers are saved before
`_monitor_subprocess()` and restored in a `finally` block.

Placing the handler in `ActivitySubprocess.wait()` (rather than
`supervise_task`) makes the forwarding work for any coordinator that
uses `ActivitySubprocess` and keeps the handler colocated with the
process it forwards to.

Fixes: #58936

Signed-off-by: AndrĂ© Ahlert <[email protected]>

Report URL: https://github.com/apache/airflow/actions/runs/26565039463

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to