Repository navigation
Fix dynamically mapped tasks never running on scheduled Dag runs - #74861
Merged
vatsrahul1001 merged 1 commit intoOct 17, 2026
Merged
Conversation
vatsrahul1001
force-pushed
the
fix-dynamic-region-commit-guard
branch
from
October 16, 2026 15:20
af08040 to
65109b0
Compare
ashb
reviewed
Oct 16, 2026
ashb
approved these changes
Oct 16, 2026
kaxil
reviewed
Oct 16, 2026
kaxil
approved these changes
Oct 16, 2026
DynamicRegion.get_or_create_many() uses a SAVEPOINT (session.begin_nested()) to safely insert dynamic-mapping regions. Releasing that SAVEPOINT dispatches the same before_commit event as a real commit, and the scheduler's CommitProhibitorGuard rejected it unconditionally, raising "UNEXPECTED COMMIT - THIS WILL BREAK HA LOCKS!" before the Dag run's task instances could be created. This only happened for a Dag run the scheduler created from its own schedule: the API server's Dag run creation runs outside the scheduler's guarded session, so the identical SAVEPOINT release there was harmless. A dynamically mapped task on a real (non-manually-triggered) schedule could therefore never run, with the same scheduling error repeating every loop. Releasing a savepoint ends neither the outer transaction nor its row locks, so it cannot break the HA locks this guard protects -- only the outer commit can, and that remains guarded.
vatsrahul1001
force-pushed
the
fix-dynamic-region-commit-guard
branch
from
October 16, 2026 16:20
65109b0 to
45e947b
Compare
eladkal
approved these changes
Oct 16, 2026
Contributor
Backport successfully created: v3-4-testNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
|
vatsrahul1001
added a commit
that referenced
this pull request
Oct 18, 2026
…ag runs (#74861) (#74918) DynamicRegion.get_or_create_many() uses a SAVEPOINT (session.begin_nested()) to safely insert dynamic-mapping regions. Releasing that SAVEPOINT dispatches the same before_commit event as a real commit, and the scheduler's CommitProhibitorGuard rejected it unconditionally, raising "UNEXPECTED COMMIT - THIS WILL BREAK HA LOCKS!" before the Dag run's task instances could be created. This only happened for a Dag run the scheduler created from its own schedule: the API server's Dag run creation runs outside the scheduler's guarded session, so the identical SAVEPOINT release there was harmless. A dynamically mapped task on a real (non-manually-triggered) schedule could therefore never run, with the same scheduling error repeating every loop. Releasing a savepoint ends neither the outer transaction nor its row locks, so it cannot break the HA locks this guard protects -- only the outer commit can, and that remains guarded. (cherry picked from commit f5038e6) Co-authored-by: Rahul Vats <43964496+vatsrahul1001@users.noreply.github.com>
vatsrahul1001
added a commit
that referenced
this pull request
Oct 20, 2026
…ag runs (#74861) (#74918) DynamicRegion.get_or_create_many() uses a SAVEPOINT (session.begin_nested()) to safely insert dynamic-mapping regions. Releasing that SAVEPOINT dispatches the same before_commit event as a real commit, and the scheduler's CommitProhibitorGuard rejected it unconditionally, raising "UNEXPECTED COMMIT - THIS WILL BREAK HA LOCKS!" before the Dag run's task instances could be created. This only happened for a Dag run the scheduler created from its own schedule: the API server's Dag run creation runs outside the scheduler's guarded session, so the identical SAVEPOINT release there was harmless. A dynamically mapped task on a real (non-manually-triggered) schedule could therefore never run, with the same scheduling error repeating every loop. Releasing a savepoint ends neither the outer transaction nor its row locks, so it cannot break the HA locks this guard protects -- only the outer commit can, and that remains guarded. (cherry picked from commit f5038e6) Co-authored-by: Rahul Vats <43964496+vatsrahul1001@users.noreply.github.com>
SameerMesiah97
pushed a commit
to SameerMesiah97/airflow-oss-sm97
that referenced
this pull request
Oct 27, 2026
…che#74861) DynamicRegion.get_or_create_many() uses a SAVEPOINT (session.begin_nested()) to safely insert dynamic-mapping regions. Releasing that SAVEPOINT dispatches the same before_commit event as a real commit, and the scheduler's CommitProhibitorGuard rejected it unconditionally, raising "UNEXPECTED COMMIT - THIS WILL BREAK HA LOCKS!" before the Dag run's task instances could be created. This only happened for a Dag run the scheduler created from its own schedule: the API server's Dag run creation runs outside the scheduler's guarded session, so the identical SAVEPOINT release there was harmless. A dynamically mapped task on a real (non-manually-triggered) schedule could therefore never run, with the same scheduling error repeating every loop. Releasing a savepoint ends neither the outer transaction nor its row locks, so it cannot break the HA locks this guard protects -- only the outer commit can, and that remains guarded.
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.
DynamicRegion.get_or_create_many() uses a SAVEPOINT (session.begin_nested()) to safely insert dynamic-mapping regions. Releasing that SAVEPOINT dispatches the same before_commit event as a real commit, and the scheduler's CommitProhibitorGuard rejected it unconditionally, raising "UNEXPECTED COMMIT - THIS WILL BREAK HA LOCKS!" before the Dag run's task instances could be created.
This only happened for a Dag run the scheduler created from its own schedule: the API server's Dag run creation runs outside the scheduler's guarded session, so the identical SAVEPOINT release there was harmless. A dynamically mapped task on a real (non-manually-triggered) schedule could therefore never run, with the same scheduling error repeating every loop.
Releasing a savepoint ends neither the outer transaction nor its row locks, so it cannot break the HA locks this guard protects — only the outer commit can, and that remains guarded.
Tested against a minimal repro Dag (scheduled
.expand()task) that reproduced the failure before this change and runs clean after it. Also added a unit test covering the guard directly: a savepoint release insideprohibit_commitno longer raises, while a real commit still does.closes: #74860
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5) following the guidelines