Repository navigation
Run triggerer asset listeners after the event is committed - #77024
kacpermuda wants to merge 2 commits into
Conversation
Lee-W
left a comment
There was a problem hiding this comment.
Could you remove the Co-Authored-By: Claude ... trailer? Our AGENTS.md says agents should not be listed as commit co-authors.
6c4cddb to
b7b3732
Compare
|
Done, good to merge, thanks ! |
hussein-awala
left a comment
There was a problem hiding this comment.
LGTM, just added a nit comment
Asset listeners ran inside the triggerer's transaction, before Dag runs were queued and before commit. A slow listener kept the transaction open, and a failed commit left listeners reporting an asset event that never existed.
b7b3732 to
b046033
Compare
|
Can we backport this to 3.4.1 ? |
I believe we can since it's a misc, but let's check with @vatsrahul1001 first |
|
This looks like a bug fix to me. But I'll let @vatsrahul1001 decide. added the label and milestone. we can remove them if we don't want ot |
The current implementation doesn't fix any bug, it just prepare for the upcoming OpenLineage listener. |
I think it's a bug, just not currently exposed by any listener that lives in airflow repo. If somebody runs their own listener that meets the criteria above, it can still kill the triggerer. So treating this as a bug fix is correct imho |
Asset listeners fired by a trigger (
on_asset_changed,on_asset_event_emitted) ran inside the triggerer's transaction, before Dag runs were queued and before commit. The task path already commits first (execution_api/routes/task_instances.py);Trigger.submit_eventnow does the same.How this can take down the triggerer: the run loop does not catch errors from
handle_events, so a failed commit stops the process. Say a custom listener posts to a webhook that hangs, for longer than Postgresidle_in_transaction_session_timeout. Postgres closes the connection, the commit raises, and the triggerer exits. With a shared-stream watcher the broker redelivers the event, the listener blocks again, and the triggerer crash-loops, so none of its triggers make progress. Even without a crash, listeners have already reported an asset event that was rolled back.The upcoming OpenLineage listener (#76773) queues its sends on a background thread, so it does not block, but it would still report rolled-back events as lineage.
related: #76750
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5.5) following the guidelines
🤖 Generated with Claude Code