This is an automated email from the ASF dual-hosted git repository.
vatsrahul1001 pushed a commit to branch v3-4-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-4-test by this push:
new 8490971033a [v3-4-test] Fix flaky in-process Execution API transport
lifecycle test on MySQL (#74785) (#74985)
8490971033a is described below
commit 8490971033abfc4543bdd964fe6c4ca16b49ad2f
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sun Oct 18 16:27:27 2026 +0530
[v3-4-test] Fix flaky in-process Execution API transport lifecycle test on
MySQL (#74785) (#74985)
On MySQL the test intermittently found the loop thread still alive.
An earlier test leaves aiomysql connections bound to a closed
TestClient loop. When GC finalizes one while this test builds the
app, the connection's __del__ raises inside pydantic's except block,
and pytest keeps that error. Its __context__ traceback holds the
frames that built the transport, so dropping the transport never ran
the finalizer that stops the loop.
(cherry picked from commit 5a6ab34fd51dd982dbf62f5c32449d74c4aa0459)
Co-authored-by: Andrew Chang <[email protected]>
---
airflow-core/tests/unit/api_fastapi/execution_api/test_app.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/airflow-core/tests/unit/api_fastapi/execution_api/test_app.py
b/airflow-core/tests/unit/api_fastapi/execution_api/test_app.py
index 196a324758a..88d210d87f0 100644
--- a/airflow-core/tests/unit/api_fastapi/execution_api/test_app.py
+++ b/airflow-core/tests/unit/api_fastapi/execution_api/test_app.py
@@ -236,6 +236,10 @@ def test_in_process_execution_api_transport_lifecycle():
left every later request hanging on a stopped loop. Dropping the transport
must stop the loop and
join the daemon thread (the a2wsgi background-thread leak guard).
"""
+ # Collect earlier tests' garbage first. If GC runs a failing __del__ (an
aiomysql connection on a closed loop)
+ # while the app below is built, pytest keeps that error, and its
__context__ chain holds the app-building
+ # frames, which keep the transport alive.
+ gc.collect()
before = {t for t in threading.enumerate() if t.name ==
"InProcessExecutionAPI-loop"}
api = InProcessExecutionAPI()