Skip to content

[v3-4-test] Fix dynamically mapped tasks never running on scheduled Dag runs (#74861) - #74918

Merged
vatsrahul1001 merged 1 commit into
v3-4-testfrom
backport-f5038e6-v3-4-test
Oct 18, 2026
Merged

vatsrahul1001 merged 1 commit into
v3-4-testfrom
backport-f5038e6-v3-4-test

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

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 [email protected]

…ag runs (#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.
(cherry picked from commit f5038e6)

Co-authored-by: Rahul Vats <[email protected]>
@shahar1
shahar1 marked this pull request as ready for review October 17, 2026 13:19
@vatsrahul1001 vatsrahul1001 added this to the Airflow 3.4.0 milestone Oct 17, 2026
@vatsrahul1001
vatsrahul1001 merged commit 604bcec into v3-4-test Oct 18, 2026
132 of 154 checks passed
@vatsrahul1001
vatsrahul1001 deleted the backport-f5038e6-v3-4-test branch October 18, 2026 05:59
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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant