kalluripradeep commented on issue #64151:
URL: https://github.com/apache/airflow/issues/64151#issuecomment-4150865970

   I've investigated this behavior and just opened a PR with a fix: #64418
   
   Root Cause: The AppBuilder is not initialized error during the /auth/token 
requests happens because the FastAPI endpoints were using the 
get_application_builder() context manager. This method was designed for offline 
CLI commands, meaning it bootstraps a brand new Flask and AppBuilder 
environment on every single request and mutates the global FabAuthManager 
singleton.
   
   When this happens, the newly created AppBuilder wipes the 
auth_manager.security_manager @cached_property. Under minimal concurrency, this 
cached property gets caught mid-evaluation or deleted entirely after the 
context ends, causing the 500 error. Setting UPDATE_FAB_PERMS=False bypasses 
the crash only because it skips early requests to the deleted security_manager 
cache during init_flask_resources().
   
   The Fix: I've updated the FabAuthManager to persistently store its primary 
Flask instance created during get_fastapi_app(). The /auth/token endpoints now 
cleanly yield auth_manager.flask_app.app_context() instead of generating 
volatile CLI setups, completely preventing the race condition.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to