Skip to content

Fix lingering task supervisors when EOF is missed - #51020

Closed
kaxil wants to merge 1 commit into
apache:mainfrom
astronomer:supervisor-socket-delay
Closed

kaxil wants to merge 1 commit into
apache:mainfrom
astronomer:supervisor-socket-delay

Conversation

@kaxil

@kaxil kaxil commented May 23, 2025 •

Copy link
Copy Markdown
Member

closes #50500

Adds a new safeguard for cases where the task subprocess closes before all pipe sockets send EOF.

The supervisor now records the
process exit time and forcibly closes any sockets still open after workers.socket_cleanup_delay. This stops the supervisor loop from hanging indefinitely and allows the process to exit cleanly.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an 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 a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

closes apache#50500

Adds a new safeguard for cases where the task subprocess closes
before all pipe sockets send EOF.

The supervisor now records the
process exit time and forcibly closes any sockets still open after
`workers.task_supervisor_socket_cleanup_delay`. This stops the
supervisor loop from hanging indefinitely and allows the process
to exit cleanly.
@ashb

ashb commented May 24, 2025

Copy link
Copy Markdown
Member

I don't love this - it "shouldn't" get in this state, and something might be missed as a result

@kaxil

kaxil commented May 24, 2025 •

Copy link
Copy Markdown
Member Author

I don't love this - it "shouldn't" get in this state, and something might be missed as a result

True, I was being conservative here but I have a different lead too. Verifying 🕐

@kaxil

kaxil commented May 24, 2025 •

Copy link
Copy Markdown
Member Author

I don't love this - it "shouldn't" get in this state, and something might be missed as a result

True, I was being conservative here but I have a different lead too. Verifying 🕐

That being said, while I don't love this either, it might not be a bad safeguard since it checks for the exit_code - which should only be set when task process exits.

@kaxil kaxil closed this May 25, 2025
@kaxil

kaxil commented May 25, 2025 •

Copy link
Copy Markdown
Member Author

I have managed to reproduce the bug - not consistently but enough that I can debug this further

I thought I did -- but not anymore

@kaxil
kaxil deleted the supervisor-socket-delay branch December 31, 2025 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The task supervisor continues running indefinitely, even after the associated task process has completed

2 participants