Fix DetachedInstanceError in OpenLineage listener when accessing DagRun note#65579
Merged
mobuchowski merged 1 commit intoApr 22, 2026
Merged
Conversation
Subham-KRLX
requested review from
amoghrajesh,
ashb,
kaxil and
mobuchowski
as code owners
April 21, 2026 03:06
Subham-KRLX
force-pushed
the
fix-openlineage-detached-instance-error
branch
from
April 21, 2026 03:08
d3bcc02 to
9729c0f
Compare
Subham-KRLX
force-pushed
the
fix-openlineage-detached-instance-error
branch
from
April 21, 2026 03:10
9729c0f to
a1abebe
Compare
mobuchowski
approved these changes
Apr 22, 2026
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
60 tasks
Collaborator
|
@Subham-KRLX that DetachedInstanceError is happening only in airflow testing environment, and has no influence on production running code, as far as I can tell (probably caused by forking we do in the OL provider and tests not being suited for that). Thanks for fixing that |
Cloud-Architect-Emma
pushed a commit
to Cloud-Architect-Emma/airflow
that referenced
this pull request
Apr 30, 2026
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.
This PR resolves a high priority regression where the OpenLineage listener crashes with a DetachedInstanceError during on_dag_run_success or on_dag_run_failed events.
The Problem: In Airflow 3.2+ the DagRun model added a note association proxy the OpenLineage DagRunInfo class attempts to access this attribute during event serialization. Since the listener often processes DagRun instances that are detached from a SQLAlchemy session this access triggers a lazy-load that fails and crashes the listener, blocking system tests (e.g., BigQuery).
The Fix: Introduced a safe_getattr utility in the OpenLineage provider that catches DetachedInstanceError and returns None as a fallback. Applied this to both note and deadlines fields in DagRunInfo to ensure the listener remains stable even when working with detached objects.
closes: #65577
Was generative AI tooling used to co-author this PR?
Yes — Claude(For pr description)