Repository navigation
Conversation
vincbeck
reviewed
Nov 24, 2026
Contributor
Author
|
@vincbeck The PR is ready to be reviewed. |
Contributor
Can you answer my comments please? |
The lookup runs inside create_session, which already rolls back and closes the scoped session when it raises, so the retry gets a fresh connection without an explicit remove(). Keeping the discard would leave a settings import, a guard and a test with no behaviour behind them. The helper docstring is trimmed to two lines, with the longer rationale kept in the PR description.
PCTEJA
force-pushed
the
fix/airflow-71395-revoked-token-stale-session
branch
from
November 29, 2026 05:01
60debb4 to
3a0e41e
Compare
Contributor
Author
|
@vincbeck Simplified as suggested: remove() gone, docstring two lines. Audited main, found no remaining leak. Close this, or keep retry? |
This branch has not been deployed
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.
With a MySQL metadata database, the first authenticated API request after the connection goes idle fails with HTTP 500. The revoked-token lookup in
BaseAuthManager.get_user_from_tokenruns on the pooled session, and when MySQL has already dropped the connection (wait_timeoutexceeded, error 4031), the query raises, so the first request fails instead of retrying on a fresh connection. The next request succeeds because the failed attempt already evicted the dead connection.This mirrors the recovery that
FABAuthManager.deserialize_useralready does: on a database error from the revocation lookup, retry the lookup once on a fresh connection (create_session rolls back and closes the failed session). If the retry also fails, the error propagates unchanged, so a genuinely unavailable database still surfaces instead of being masked.This revives the approach from #71444, which the reporter ran in production for weeks before it was closed by the stale bot; the fix here applies it at the shared
BaseAuthManagerlevel so every auth manager that relies on the revoked-token check gets the same recovery.closes: #71395
Verification
test_base_auth_manager.pycovering the recovery path: the retry succeeds after a stale-connection error, a revoked token is still rejected after a retry, and a persistent error propagates after exactly one retry.RevokedToken.is_revokedcall) fails with exactly the reportedsqlalchemy.exc.OperationalError: (4031, 'The client was disconnected...').airflow-core/tests/unit/api_fastapi/auth/managers/test_base_auth_manager.py: 72 passed. Ruff format and check pass; mypy for airflow-core passes.Was generative AI tooling used to co-author this PR?
Generated-by: I used ChatGPT astra only for inline code completion following the guidelines