Uh oh!
There was an error while loading. Please reload this page.
Fix in-process Execution API loop stopped while its transport is in use - #68855
Closed
potiuk wants to merge 2 commits into
Closed
Fix in-process Execution API loop stopped while its transport is in use#68855potiuk wants to merge 2 commits into
potiuk wants to merge 2 commits into
Conversation
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.
potiukforce-pushed
the
fix-in-process-execution-api-loop-lifecycle
branch
from
June 22, 2026 19:13
fb08675 to
48b2427Comparepotiuk
commented
Jun 22, 2026
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Jun 22, 2026
seanghaeli
commented
Jun 22, 2026
Contributor
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. |
potiuk
commented
Jun 23, 2026
MemberAuthor
Fixed by #68865 copied from this one |
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 freeto 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.
The in-process Execution API owns a background asyncio event loop + daemon thread. Their cleanup was registered with
weakref.finalizekeyed on theInProcessExecutionAPIinstance. But callers build a syncClientfromInProcessExecutionAPI().transportand 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 asTimeoutfailures 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.
Follow up after #68840
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.