Fix Calendar view hanging for Dags with high-frequency cron schedules - #71263
Open
theJohnnyBrown wants to merge 2 commits into
Open
Fix Calendar view hanging for Dags with high-frequency cron schedules#71263theJohnnyBrown wants to merge 2 commits into
theJohnnyBrown wants to merge 2 commits into
Conversation
The planned-runs computation for cron timetables iterates croniter until the year boundary with no cap, while the generic-timetable path stops at MAX_PLANNED_RUNS. For "*/5 * * * *" that is ~105k iterations (~2s) per calendar request, ~520k (~7s) for a minutely cron, and ~31M (minutes of CPU) for a seconds-resolution cron - enough for any user with Dag read access to pin an API server worker just by opening the Calendar tab. Apply the same MAX_PLANNED_RUNS cap the generic path has used since the endpoint was added.
theJohnnyBrown
requested review from
bugraoz93,
choo121600,
ephraimbuddy,
henry3260,
jason810496,
pierrejeambrun,
rawwar and
shubhamraj-git
as code owners
August 7, 2026 00:10
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Calendar view's planned-runs computation for cron timetables iterates croniter until the year boundary with no cap, while the generic-timetable path has always stopped at
MAX_PLANNED_RUNS(2000). The scan runs synchronously in the request handler on every calendar request, and the date-range filter does not bound it (filtered dates are skipped, not stopped at).Measured cost of the unbounded loop per
GET /ui/calendar/{dag_id}request:*/5 * * * ** * * * ** * * * * *(seconds cron)Any user with Dag read access triggers this just by opening the Calendar tab of such a Dag, which can pin an API server worker.
This applies the same
MAX_PLANNED_RUNScap the generic path has used since the endpoint was added (#52748), viaitertools.islice. Planned cells for high-frequency crons are now shown up to 2000 runs ahead, consistent with what an equivalenttimedelta-scheduled Dag already does.The new test fails without the fix (the request returns ~300k planned runs after ~4.5 s) and passes with it; all existing calendar tests pass.
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Fable 5) following the guidelines