fix: recover from stale DB session on revoked-token check (#71395) - #71396
fix: recover from stale DB session on revoked-token check (#71395)#71396waterWang wants to merge 1 commit into
Conversation
|
Closing this as part of a cleanup of a large batch of PRs opened in quick succession from this account. 18 PRs have been opened here in the past two weeks and none have merged. Several show signs of being generated and submitted without review: #71432 and #71433 are the same change across the same five files, opened two minutes apart, and several titles carry a leaked agent identifier that other contributors already flagged as garbled text on #70629 and #71322. Airflow is maintained by volunteers. Every PR costs reviewer time and CI capacity, so a high volume of unvetted submissions has a real cost to the project. You are welcome to keep contributing. Please open one change at a time, run it locally against the tests, and read the contributors' guide before submitting. If you think a specific change here is correct, comment with the reasoning and a maintainer can reopen it. Note for @vincbeck: this PR carried your approval. It is being closed as part of the batch cleanup above, not on the merits of the diff. Happy to reopen if you would rather see it land. |
fixes #71395 (apache/airflow)
Problem
After the api-server sits idle longer than MySQL
wait_timeout, the first authenticated request fails with HTTP 500. TheOperationalError(MySQL 4031) is raised fromRevokedToken.is_revoked, which runs insideBaseAuthManager.get_user_from_tokenbeforedeserialize_user. The recovery added in #62919 (discard-and-retry inFabAuthManager.deserialize_user) does not cover this earlier check, so the stale-session 500 is back, just one step earlier in the auth path.Fix
Apply the same discard-and-retry recovery to the revoked-token check: on
SQLAlchemyError, discard the poisoned scoped session (settings.Session.remove()) and retry once on a fresh connection. Mirrors the pattern inFabAuthManager.deserialize_user(#62919).