pierrejeambrun opened a new pull request, #44187:
URL: https://github.com/apache/airflow/pull/44187

   I scratched my head on this one.
   
   # Problem
   Tests are green, CI is green, manual API testing looks good, but when we use 
the UI, we see random 500 errors from time to time, cf screenshot.
   
   All that hint to a bug in the session management. Between the DB dependency 
from fastapi, the way fastapi uses multiple thread to serve `sync` route 
requests, how we create session in airflow utility code and when / how are 
sessions rolled back / commited.
   
   TLDL:
   The default `Session` factory use sessionmaker that will make a session 
thread local, on the other hand FastAPI can re-use the same thread to serve 
multiple requests but because of the dependency we use, the session is close 
after each request.
   
   Session lifecycle that we want is not `per thread` but `per  HTTTP request`. 
To achieve that we delegate the `session` handling to FastAPI dependency system.
   
   


-- 
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