Uh oh!
There was an error while loading. Please reload this page.
Fix in-process Execution API loop stopped while transport still in use - #68865
Merged
o-nikolas merged 2 commits intoJun 23, 2026
Conversation
apache#68840 moved the InProcessExecutionAPI background event-loop + thread cleanup into a weakref.finalize keyed on the InProcessExecutionAPI instance. But callers build a sync Client from InProcessExecutionAPI().transport and discard the factory object, so the instance is garbage-collected while the transport is still in use. The finalizer then stops the loop, and every subsequent request hangs on the dead loop -- surfacing as Timeout failures across the Dag-processor and triggerer in-process API tests on main (Error while closing in-process execution API lifespan -> TimeoutError). Key the finalizer on the returned WSGI transport instead of the factory instance, so loop/thread/lifespan teardown happens when the transport (which the Client holds) is collected, not when the throwaway factory is. Verified locally: test_processor.py::test_top_level_variable_set and test_top_level_variable_access_not_found now pass (previously hung to timeout).
Rewrite test_in_process_execution_api_teardown as test_in_process_execution_api_transport_lifecycle: assert that dropping the factory instance leaves the loop running while the transport is held, and only dropping the transport stops the loop + joins the daemon thread. This fails against finalizing on the instance (the regression) and passes with the finalizer keyed on the transport. Verified locally: 1 passed in 11.58s.
o-nikolas
approved these changes
Jun 23, 2026
Uh oh!
There was an error while loading. Please reload this page.
1 task
cetingokhan pushed a commit
to cetingokhan/airflow
that referenced
this pull request
Jun 24, 2026
apache#68865) * Fix in-process Execution API loop stopped while transport still in use apache#68840 moved the InProcessExecutionAPI background event-loop + thread cleanup into a weakref.finalize keyed on the InProcessExecutionAPI instance. But callers build a sync Client from InProcessExecutionAPI().transport and discard the factory object, so the instance is garbage-collected while the transport is still in use. The finalizer then stops the loop, and every subsequent request hangs on the dead loop -- surfacing as Timeout failures across the Dag-processor and triggerer in-process API tests on main (Error while closing in-process execution API lifespan -> TimeoutError). Key the finalizer on the returned WSGI transport instead of the factory instance, so loop/thread/lifespan teardown happens when the transport (which the Client holds) is collected, not when the throwaway factory is. Verified locally: test_processor.py::test_top_level_variable_set and test_top_level_variable_access_not_found now pass (previously hung to timeout). * Test transport-tied lifecycle for in-process Execution API Rewrite test_in_process_execution_api_teardown as test_in_process_execution_api_transport_lifecycle: assert that dropping the factory instance leaves the loop running while the transport is held, and only dropping the transport stops the loop + joins the daemon thread. This fails against finalizing on the instance (the regression) and passes with the finalizer keyed on the transport. Verified locally: 1 passed in 11.58s. --------- Co-authored-by: Sean Ghaeli <ghaeli@amazon.com>
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.
Fix failing CIs, same as #68855 but needed fixing now (just a typo) so opening this PR