From 11dda28597a9c7b6d75a3f3930b9036ee36d16af Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Wed, 7 Jan 2026 21:39:01 +0100 Subject: [PATCH] [v3-1-test] Protect against hanging thread in aiosqlite 0.22+ (#60217) The change in model of aiosqlite impacted sqlalchemy handling of closing the connection - the way how currrent sqlalchemy works with it is that it leaves threads hanging. This is fixed in sqlalchemy main - https://github.com/sqlalchemy/sqlalchemy/issues/13039 but until they release it and until we have the sqlalchemy>=2.0.46, we should upper-bind the aiosqlite (cherry picked from commit 9b364ca50ae85fe52c5e636cb3e5cc9e9f787edf) Co-authored-by: Jarek Potiuk --- airflow-core/pyproject.toml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/airflow-core/pyproject.toml b/airflow-core/pyproject.toml index 9b5ece9c0963e..3a09090ebbc65 100644 --- a/airflow-core/pyproject.toml +++ b/airflow-core/pyproject.toml @@ -69,7 +69,11 @@ dependencies = [ "a2wsgi>=1.10.8", # aiosqlite 0.22.0 has a problem with hanging pytest sessions and we excluded it # See https://github.com/omnilib/aiosqlite/issues/369 - "aiosqlite>=0.20.0,!=0.22.0", + # It seems that while our test issues are fixed in 0.22.1, sqlalchemy 2 itself + # is not compatible with it and leaves thread hanging This is already fixed in main of sqlalchemy + # But not released yet - and we will likely have to add >=2.0.46+ for sqlalchemy when released to + # protect against it https://github.com/sqlalchemy/sqlalchemy/issues/13039 + "aiosqlite>=0.20.0,<0.22.0", # Alembic is important to handle our migrations in predictable and performant way. It is developed # together with SQLAlchemy. Our experience with Alembic is that it very stable in minor version # The 1.13.0 of alembic marked some migration code as SQLAlchemy 2+ only so we limit it to 1.13.1