Skip to content

Fix DetachedInstanceError in OpenLineage listener when accessing DagRun note#65579

Merged
mobuchowski merged 1 commit intoapache:mainfrom
Subham-KRLX:fix-openlineage-detached-instance-error
Apr 22, 2026
Merged

Fix DetachedInstanceError in OpenLineage listener when accessing DagRun note#65579
mobuchowski merged 1 commit intoapache:mainfrom
Subham-KRLX:fix-openlineage-detached-instance-error

Conversation

@Subham-KRLX
Copy link
Copy Markdown
Contributor

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)

@Subham-KRLX Subham-KRLX changed the title Fix openlineage detached instance error Fix DetachedInstanceError in OpenLineage listener when accessing DagRun note Apr 21, 2026
@Subham-KRLX Subham-KRLX force-pushed the fix-openlineage-detached-instance-error branch from d3bcc02 to 9729c0f Compare April 21, 2026 03:08
@mobuchowski mobuchowski merged commit 052d27f into apache:main Apr 22, 2026
93 checks passed
@boring-cyborg
Copy link
Copy Markdown

boring-cyborg Bot commented Apr 22, 2026

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

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.

OpenLineage listener causes DetachedInstanceError in system tests

2 participants