Skip to content

W-23459262 fix(python-binding): bound streaming output queue and stop leaking worker threads#122

Merged
mlischetti merged 1 commit into
masterfrom
fix/python-binding-streaming-backpressure
Jul 15, 2026
Merged

W-23459262 fix(python-binding): bound streaming output queue and stop leaking worker threads#122
mlischetti merged 1 commit into
masterfrom
fix/python-binding-streaming-backpressure

Conversation

@mlischetti

Copy link
Copy Markdown
Contributor

Extracted from #119 so the fixes to the pre-existing Python binding can be reviewed and merged independently of the new C/Go/Rust bindings.

Changes

native-lib/python/src/dataweave/__init__.py

  • Unbounded queue → OOM: bound the streaming/transform output queue (maxsize=512) with a timed put(timeout=30). A slow or abandoned consumer now exerts backpressure onto the native producer instead of growing an
    unbounded queue. On timeout the write callback returns -1 to abort the native side.
  • Leaked worker threads: make the worker thread non-daemon and join(timeout=30), raising DataWeaveError on timeout, so worker threads are not silently orphaned.

Notes

  • Branches off master; touches only the pre-existing Python binding — no dependency on the new bindings in Native-bindings #119.
  • Repro/regression tests intentionally left in Native-bindings #119 per the extraction scope (source fixes only).

…rker threads

Extracted from the native-bindings work in PR #119 so the fixes to the
pre-existing Python binding can be reviewed and merged independently of the
new C/Go/Rust bindings.

- Bound the streaming/transform output queue (maxsize=512) with a timed
  put(timeout=30) so a slow or abandoned consumer exerts backpressure onto
  the native producer instead of growing an unbounded queue that can OOM.
  On timeout the write callback returns -1 to abort the native side.
- Make the worker thread non-daemon and join with a timeout, raising
  DataWeaveError on timeout, so worker threads are not silently leaked when
  the interpreter continues.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mlischetti
mlischetti requested a review from a team as a code owner July 15, 2026 16:07
@mlischetti
mlischetti merged commit ddc46bc into master Jul 15, 2026
3 checks passed
@mlischetti
mlischetti deleted the fix/python-binding-streaming-backpressure branch July 15, 2026 17:31
mlischetti added a commit that referenced this pull request Jul 16, 2026
The native-lib/node/repro and native-lib/python/repro folders are regression
guards for the pre-existing Node and Python bindings, covering fixes that
already merged to master independently (PR #121 read-callback exception, PR
#122 streaming queue backpressure). They are unrelated to the new C/Go/Rust
bindings this branch introduces, are not wired into any build/CI, and were
intentionally excluded when the Node/Python docs were extracted (PR #126).

Remove them so they do not re-land on master with this feature. The C and Go
repro folders remain — they exercise the new bindings added here.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mlischetti added a commit that referenced this pull request Jul 16, 2026
The native-lib/node/repro and native-lib/python/repro folders are regression
guards for the pre-existing Node and Python bindings, covering fixes that
already merged to master independently (PR #121 read-callback exception, PR
#122 streaming queue backpressure). They are unrelated to the new C/Go/Rust
bindings this branch introduces, are not wired into any build/CI, and were
intentionally excluded when the Node/Python docs were extracted (PR #126).

Remove them so they do not re-land on master with this feature. The C and Go
repro folders remain — they exercise the new bindings added here.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants