Future DagRun rarely triggered by Race Condition when max_active_runs has reached its upper limit #31407
Open
2 tasks done
Labels
affected_version:2.2
Issues Reported for 2.2
area:core
good first issue
kind:bug
This is a clearly a bug
Apache Airflow version
Other Airflow 2 version (please specify below)
What happened
The scheduler rarely triggers a DagRun to be executed in the future.
Here are the conditions as I understand them.
Details in "Anything else".
What you think should happen instead
DagRun should wait until scheduled
How to reproduce
I have confirmed reproduction in Airflow 2.2.2 with the following code.
I reproduced it in my environment after running it for about half a day.
Operating System
Amazon Linux 2
Versions of Apache Airflow Providers
No response
Deployment
Official Apache Airflow Helm Chart
Deployment details
MWAA 2.2.2
Anything else
The assumed flow and the associated actual query logs for the case max_active_runs=2 are shown below.
The assumed flow
next_dagrun_create_after=null
if max_active_runs is exceededcalculate_dagrun_date_fields
is the old DR1-based value fromdag.get_run_data_interval(DR"2")
.Processor
can select it and update it.guard.commit()
next_dagrun_create_after
column set to null in step 2 is updated because sqlalchemy only updates the difference between the record retrieved in step 4 and the calculation resultThe associated query log
From what I've read of the relevant code in the latest v2.6.1, I believe the problem continues.
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: