You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "potiuk (via GitHub)" <gi...@apache.org> on 2026/06/22 19:12:40 UTC
[PR] Fix in-process Execution API loop stopped while its transport is in use [airflow]
potiuk opened a new pull request, #68855:
URL: https://github.com/apache/airflow/pull/68855
The in-process Execution API owns a background asyncio event loop + daemon thread. Their cleanup was registered with `weakref.finalize` keyed on the `InProcessExecutionAPI` instance. But callers build a sync `Client` from `InProcessExecutionAPI().transport` and discard the factory object, so the instance was garbage-collected while the transport was still in use. The finalizer then stopped the loop, and every subsequent request hung on the dead loop -- surfacing as `Timeout` failures across the Dag-processor and triggerer in-process API tests on main.
Tie the loop + thread + lifespan cleanup to the lifetime of the WSGI transport (what callers actually retain) instead of the factory instance. This keeps the original thread-leak fix intact -- the loop is still stopped and the thread joined once nothing can use the transport -- while no longer tearing it down prematurely.
<!-- SPDX-License-Identifier: Apache-2.0
https://www.apache.org/licenses/LICENSE-2.0 -->
<!--
Thank you for contributing!
Please provide above a brief description of the changes made in this pull request.
Write a good git commit message following this guide: http://chris.beams.io/posts/git-commit/
Please make sure that your code changes are covered with tests.
And in case of new features or big changes remember to adjust the documentation.
For user-facing UI changes, please attach before/after screenshots (or a short
screen recording) so reviewers can assess the visual impact.
Feel free to ping (in general) for the review if you do not see reaction for a few days
(72 Hours is the minimum reaction time you can expect from volunteers) - we sometimes miss notifications.
In case of an existing issue, reference it using one of the following:
* closes: #ISSUE
* related: #ISSUE
-->
---
##### Was generative AI tooling used to co-author this PR?
<!--
If generative AI tooling has been used in the process of authoring this PR, please
change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by".
-->
- [ ] Yes (please specify the tool below)
<!--
Generated-by: [Tool Name] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
-->
---
* Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
* For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
* When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
* For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix in-process Execution API loop stopped while its transport is in use [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #68855:
URL: https://github.com/apache/airflow/pull/68855#issuecomment-4775081518
Fixed by https://github.com/apache/airflow/pull/68865 copied from this one
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix in-process Execution API loop stopped while its transport is in use [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #68855:
URL: https://github.com/apache/airflow/pull/68855#discussion_r3455240980
##########
airflow-core/src/airflow/api_fastapi/execution_api/app.py:
##########
@@ -350,9 +350,9 @@ def get_extra_schemas() -> dict[str, dict]:
}
-# Note: _shutdown_loop is used as a finalizer for :class:`InProcessExecutionAPI`. As such, its arguments must
-# not directly or indirectly reference the instance itself, as this will prevent the instance from being
-# garbage collected.
+# Note: _shutdown_loop is used as a finalizer for the WSGI transport returned by
+# :meth:`InProcessExecutionAPI.transport`. As such, its arguments must not directly or indirectly reference
Review Comment:
```suggestion
`InProcessExecutionAPI.transport`. As such, its arguments must not directly or indirectly reference
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix in-process Execution API loop stopped while its transport is in use [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk closed pull request #68855: Fix in-process Execution API loop stopped while its transport is in use
URL: https://github.com/apache/airflow/pull/68855
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix in-process Execution API loop stopped while its transport is in use [airflow]
Posted by "seanghaeli (via GitHub)" <gi...@apache.org>.
seanghaeli commented on PR #68855:
URL: https://github.com/apache/airflow/pull/68855#issuecomment-4774220878
Hi @potiuk, thanks for the fix, sorry for jumping in, I assume you're asleep so I made another PR for the full fix so it can be merged now, needed it urgently for downstream PRs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org