Skip to content

Comments

Fix: Add session rollback to FAB find_user on error to prevent invali…#61374

Merged
vincbeck merged 4 commits intoapache:mainfrom
MonsterChenzhuo:fix1
Feb 5, 2026
Merged

Fix: Add session rollback to FAB find_user on error to prevent invali…#61374
vincbeck merged 4 commits intoapache:mainfrom
MonsterChenzhuo:fix1

Conversation

@MonsterChenzhuo
Copy link
Contributor

@MonsterChenzhuo MonsterChenzhuo commented Feb 3, 2026

Description

This PR adds exception handling and session rollback to the find_user method in FabAirflowSecurityManagerOverride.

Motivation and Context

Currently, the find_user method in the FAB security manager override only catches MultipleResultsFound exceptions. If any other exception occurs during the database query (e.g., a temporary database disconnection, query timeout, or an _invalid_transaction state), the session is not rolled back.

This leaves the SQLAlchemy session in a broken/dirty state. Since sessions are often reused in the worker process, subsequent requests (like login attempts) fail continuously with errors like:
img_v3_02uk_501b3c4c-211b-4c18-a181-fb5f32b4ba9g

@boring-cyborg
Copy link

boring-cyborg bot commented Feb 3, 2026

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 (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@vincbeck vincbeck merged commit 0e66a21 into apache:main Feb 5, 2026
86 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Feb 5, 2026

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants