Repository navigation
Close the session after the FAB permissions collection read - #72950
Merged
Merged
Conversation
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
vincbeck
approved these changes
Sep 11, 2026
7 of 12 tasks
xvega
pushed a commit
to xvega/airflow
that referenced
this pull request
Sep 13, 2026
dlactin
pushed a commit
to dlactin/airflow
that referenced
this pull request
Sep 14, 2026
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.
GET /auth/fab/v1/permissionsstill runs its two queries throughsecurity_manager.session, the thread-local scoped session, without ending the transaction. The route is a sync FastAPI handler, so it runs on a threadpool thread, and theSession.remove()thatcleanup_session_middlewareissues on the event-loop thread never reaches that session. On PostgreSQL the backend staysidle in transactionafter the 200 response, which is the leak #72362 describes for the users and roles collections. #72578 fixed those two; this applies the samecreate_session(scoped=False)block to the permissions collection, the last collection handler in the FAB FastAPI services that read through the scoped session.Changes
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/services/roles.py:FABAuthManagerRoles.get_permissionsruns insidecreate_session(scoped=False), likeget_rolesandget_usersproviders/fab/tests/unit/fab/auth_manager/api_fastapi/services/test_roles.py: the fiveget_permissionstests patchcreate_sessionand assert the session is entered once and exited, including on the 400 pathTesting
providers/fab:tests/unit/fab/auth_manager/api_fastapi/services/test_roles.pyandtests/unit/fab/auth_manager/api_fastapi/routes/test_roles.py(54 tests)closes: #72362
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Claude Fable 5.1) following the guidelines. I reviewed and understand all changes; the tests were run locally as listed above.
🤖 Generated with Claude Code