Stop task supervisors after an init process reaps its child#70163
Draft
hooiv wants to merge 1 commit into
Draft
Conversation
Init processes such as dumb-init can reap a task child before the supervisor collects its exit status. Treat the process as exited so socket cleanup can enforce its deadline. Signed-off-by: ADITYA CHAUHAN <125276621+hooiv@users.noreply.github.com>
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
2 tasks
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.
What type of change is this?
Bug fix.
What does this PR do?
Fixes a task supervisor hang when an init process such as
dumb-initreaps the task child before the supervisor collects its exit status.psutil.Process.wait(timeout=0)raisesNoSuchProcessin that situation. Previously, the supervisor left both_exit_codeand_process_exit_monotonicunset, so the socket cleanup timeout never started and the supervisor could remain alive indefinitely while retaining task sockets and memory.The supervisor now treats the child as exited with the same unknown exit code used by the existing already-terminated kill path and starts the cleanup timer. Added a regression test for the reaped-child path.
Fixes #70117.
Testing
uv run --project task-sdk ruff format task-sdk/src/airflow/sdk/execution_time/supervisor.py task-sdk/tests/task_sdk/execution_time/test_supervisor.pyuv run --project task-sdk ruff check --fix task-sdk/src/airflow/sdk/execution_time/supervisor.py task-sdk/tests/task_sdk/execution_time/test_supervisor.pyTestWatchedSubprocess::test_process_already_reaped— passedtest_supervisor.py: 166 passed, 6 skipped; remaining failures/errors were pre-existing mounted-Windows checkout issues (path-sensitive log assertions, missing optional provider/shared-package setup)Checklist