Skip to content

[v3-3-test] Release TI lock before asset listener callbacks (#70951) - #71065

Merged
vatsrahul1001 merged 2 commits into
v3-3-testfrom
backport-79db995-v3-3-test
Aug 4, 2026
Merged

[v3-3-test] Release TI lock before asset listener callbacks (#70951)#71065
vatsrahul1001 merged 2 commits into
v3-3-testfrom
backport-79db995-v3-3-test

Conversation

@github-actions

@github-actions github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor
  • Release TI lock before asset listener callbacks

Asset registration on the task-success path (ti_update_state) ran the
listener hooks synchronously inside the transaction holding a row lock
on the task_instance table. A slow listener, multiplied across a large
fan-out of asset events, could hold that lock for minutes, causing
statement timeouts.

The listener hooks are now deferred until the end of the endpoint
instead of executed inline during asset event creation. Registration
writes to the database still happen under the caller's transaction, so
durability is unchanged; this only moves the best-effort listener hooks
off the lock.

  • Optimize asset alias assoc insert

  • Fix exhausted iterator reuse bug

  • Test asset reg callback cases
    (cherry picked from commit 79db995)

Co-authored-by: Tzu-ping Chung uranusjr@gmail.com

* Release TI lock before asset listener callbacks

Asset registration on the task-success path (ti_update_state) ran the
listener hooks synchronously inside the transaction holding a row lock
on the task_instance table. A slow listener, multiplied across a large
fan-out of asset events, could hold that lock for minutes, causing
statement timeouts.

The listener hooks are now deferred until the end of the endpoint
instead of executed inline during asset event creation. Registration
writes to the database still happen under the caller's transaction, so
durability is unchanged; this only moves the best-effort listener hooks
off the lock.

* Optimize asset alias assoc insert

* Fix exhausted iterator reuse bug

* Test asset reg callback cases
(cherry picked from commit 79db995)

Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
@boring-cyborg boring-cyborg Bot added area:API Airflow's REST/HTTP API area:task-sdk labels Aug 4, 2026
@vatsrahul1001
vatsrahul1001 marked this pull request as ready for review August 4, 2026 06:59
@vatsrahul1001 vatsrahul1001 added this to the Airflow 3.3.1 milestone Aug 4, 2026
@vatsrahul1001 vatsrahul1001 added the type:bug-fix Changelog: Bug Fixes label Aug 4, 2026
@uranusjr

uranusjr commented Aug 4, 2026

Copy link
Copy Markdown
Member

I found a small gap for this, fixing in #71076. The two will need to be backported together.

@uranusjr

uranusjr commented Aug 4, 2026

Copy link
Copy Markdown
Member

Backport for #71076 will be added to this PR.

@uranusjr
uranusjr force-pushed the backport-79db995-v3-3-test branch from 2efe792 to b5e4f91 Compare August 4, 2026 11:25
@vatsrahul1001
vatsrahul1001 merged commit e681907 into v3-3-test Aug 4, 2026
75 checks passed
@vatsrahul1001
vatsrahul1001 deleted the backport-79db995-v3-3-test branch August 4, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API area:task-sdk type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants