Skip to content

Remove ResourceWarnings from TaskSDK#47462

Merged
ashb merged 1 commit intomainfrom
close-tasksdk-supervisor-sockets-properly
Mar 6, 2025
Merged

Remove ResourceWarnings from TaskSDK#47462
ashb merged 1 commit intomainfrom
close-tasksdk-supervisor-sockets-properly

Conversation

@ashb
Copy link
Copy Markdown
Member

@ashb ashb commented Mar 6, 2025

It turns out that the way SocketIO (which is the class you get from)
sock.makefile doesn't actually close the socket when you close the IO
object, which normally is fine as the socket won't be around and will clean up
nicely, but due to forking and us actually wanting to close the socket, we
need to be a bit more careful about how we do this.

It also turns out I misunderstood when set_inheritable applies. It is not
about when forking, but specifically only when execing. So I've removed that
setting as we don't need it.

Closes #46048, and relates to #47294 (it might close it, it might not, unsure
at this point)


^ 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 newsfragments.

It turns out that the way SocketIO (which is the class you get from)
`sock.makefile` doesn't _actually_ close the socket when you close the IO
object, which normally is fine as the socket won't be around and will clean up
nicely, but due to forking and us _actually_ wanting to close the socket, we
need to be a bit more careful about how we do this.

It also turns out I misunderstood when `set_inheritable` applies. It is not
about when forking, but specifically only when execing. So I've removed that
setting as we don't need it.

Closes #46048, and relates to #47294 (it might close it, it might not, unsure
at this point)
@ashb
Copy link
Copy Markdown
Member Author

ashb commented Mar 6, 2025

Shoutout to @tirkarthi for the easy reproduction steps.

@ashb ashb merged commit 9d64a0a into main Mar 6, 2025
@ashb ashb deleted the close-tasksdk-supervisor-sockets-properly branch March 6, 2025 18:21
nailo2c pushed a commit to nailo2c/airflow that referenced this pull request Apr 4, 2025
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.

Airflow dag processor exits with too many open files after sometime

2 participants