Skip to content

fix several async transport issues#4694

Merged
mobuchowski merged 1 commit into
mainfrom
fix-dd-transport
Jul 7, 2026
Merged

fix several async transport issues#4694
mobuchowski merged 1 commit into
mainfrom
fix-dd-transport

Conversation

@mobuchowski

@mobuchowski mobuchowski commented Jul 6, 2026

Copy link
Copy Markdown
Member

Summary

This fixes 3 bugs in the Datadog transport that caused Airflow scheduler CPU to climb until it hit its limit (issue #4683). The transport built an async HTTP worker thread for every instance, even when nothing routed to it, and that thread polled constantly even when idle. A separate bug also leaked memory when a run's START event failed.

What was wrong

DatadogTransport built an AsyncHttpTransport on every construction, whether or not any event ever used it. Building AsyncHttpTransport starts a daemon thread. With the default routing rules, most events never use the async path, so most of these threads did nothing but consume CPU.

Each idle thread polled its queue every 0.01 seconds, forever. On a production scheduler that built one client per event, this added up: 50 instances used 29.5% CPU while idle, 400 instances used 167.6%.

A third bug caused a memory leak: when a run's START event failed after all retries, any completion events already queued for that run stayed in memory. Nothing released them.

What changed

We made 3 changes to client/python/src/openlineage/client/transport/:

  • datadog.py now builds the async transport only when an event actually needs it, not on every construction. Most deployments will never build it at all.
  • async_http.py now backs off when idle. The worker thread sleeps for 0.01 seconds after the queue is empty, then doubles that wait each time it stays empty, up to 1 second. It resets to 0.01 seconds as soon as new work arrives.
  • async_http.py now clears out a run's pending completion events if its START event fails after all retries, and logs a warning when it does. Before this change, those events stayed in memory indefinitely.

Checklist

  • AI was used in creating this PR

Comment thread client/python/src/openlineage/client/transport/async_http.py
Comment thread client/python/src/openlineage/client/transport/datadog.py
@codecov-commenter

codecov-commenter commented Jul 6, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.72%. Comparing base (b54853f) to head (0a336a7).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4694   +/-   ##
=======================================
  Coverage   73.72%   73.72%           
=======================================
  Files          21       21           
  Lines        2356     2356           
=======================================
  Hits         1737     1737           
  Misses        619      619           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Maciej Obuchowski <maciej.obuchowski@datadoghq.com>
@mobuchowski
mobuchowski merged commit e41c776 into main Jul 7, 2026
25 checks passed
@mobuchowski
mobuchowski deleted the fix-dd-transport branch July 7, 2026 09:54
wangxiaojing pushed a commit to wangxiaojing/OpenLineage that referenced this pull request Jul 21, 2026
Signed-off-by: Maciej Obuchowski <maciej.obuchowski@datadoghq.com>
Signed-off-by: wangxiaojing <u9jing@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:client/python openlineage-python area:tests Testing code language:python Uses Python programming language

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants