devgonvarun opened a new issue, #58327:
URL: https://github.com/apache/airflow/issues/58327

   ### Apache Airflow version
   
   main (development)
   
   ### If "Other Airflow 2/3 version" selected, which one?
   
   3.1.1
   
   ### What happened?
   
   With `AIRFLOW__DATABASE__SQL_ALCHEMY_ENGINE_ARGS` set to `{"echo": true, 
"expire_on_commit": true}` I noticed that the SQL queries are frequently 
reusing cached/stale results in the scheduler and API/webserver logs, caches 
from some hundred seconds old to thousand of seconds. This is leading to always 
delays of around 2 minutes between manual dag triggers from UI and scheduler 
picking up the dag despite only a configured heartbeat of 2s. 
   
   ### What you think should happen instead?
   
   With every database query to the metadata the results should be freshly 
fetched. 
   
   I found that `expire_on_commit` is set to False in the session_maker in 
https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/settings.py
   
   Could this be a reason for this problem? 
   
   ### How to reproduce
   
   Airflow in kubernetes installation. Set 
`AIRFLOW__DATABASE__SQL_ALCHEMY_ENGINE_ARGS` environment variable to `{"echo": 
true}` to see the sqlalchemy query results cached periods. Use 
KubernetesExecutor. Trigger a dag manually from the UI. 
   
   ### Operating System
   
   Debian GNU/Linux 12 (bookworm)
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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