Repository navigation
Conversation
Use explicit non-scoped sessions for FAB users and roles collection queries so sync FastAPI worker threads close their own PostgreSQL transactions.
Use explicit non-scoped sessions for FAB users and roles collection queries so sync FastAPI worker threads close their own PostgreSQL transactions.
Verify collection queries use a non-scoped session and close it after materializing the response.
Verify role collection queries use a non-scoped session and close it after materializing the response.
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
vincbeck
approved these changes
Sep 9, 2026
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
imrichardwu
pushed a commit
to imrichardwu/airflow
that referenced
this pull request
Sep 11, 2026
…pache#72578) Use explicit non-scoped sessions for FAB users and roles collection queries so sync FastAPI worker threads close their own PostgreSQL transactions.
1 task done
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 free
to 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.
Summary
security_manager.sessionin the users and roles collection handlers with explicitcreate_session(scoped=False)contexts.scoped=Falseand exited on success and validation errors.This addresses the sync FastAPI/thread-pool session leak described in #72361 and follows the explicit-session pattern used by Airflow's API code.
Fixes #72361
Testing
PYTHONPATH=devel-common/src uv run --project providers/fab --no-dev --with pytest --with pytest-subtests --with pytest-timeout --with time-machine --with pytest-asyncio --with pytest-mock pytest providers/fab/tests/unit/fab/auth_manager/api_fastapi/services/test_users.py providers/fab/tests/unit/fab/auth_manager/api_fastapi/services/test_roles.py -q