fix(engine): use flume async API in shared MPMC channel#3385
Open
ThomsonTan wants to merge 2 commits into
Open
fix(engine): use flume async API in shared MPMC channel#3385ThomsonTan wants to merge 2 commits into
ThomsonTan wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a potential deadlock/head-of-line blocking scenario in the engine’s shared MPMC channel abstraction by switching the flume-backed variant from the synchronous send()/recv() APIs to flume’s async send_async().await / recv_async().await APIs when used inside async fn.
Changes:
- Update
SharedSender::sendfor the MPMC (flume) backend to usesend_async(...).await. - Update
SharedReceiver::recvfor the MPMC (flume) backend to userecv_async().await. - Add a regression test that exercises
recvpolled beforesendon a single-thread Tokio runtime to ensure no runtime-thread blocking/deadlock (issue #1704), plus a changelog entry.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| rust/otap-dataflow/crates/engine/src/shared/message.rs | Switch flume MPMC send/recv to async APIs and add a regression test proving the runtime thread is not blocked. |
| rust/otap-dataflow/.chloggen/engine-flume-mpmc-async-blocking.yaml | Add a user-facing changelog entry documenting the engine fix for flume MPMC async behavior (issue #1704). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3385 +/- ##
==========================================
- Coverage 86.23% 86.23% -0.01%
==========================================
Files 739 739
Lines 292355 292382 +27
==========================================
+ Hits 252116 252130 +14
- Misses 39715 39728 +13
Partials 524 524
🚀 New features to boost your workflow:
|
jmacd
approved these changes
Jul 1, 2026
albertlockett
approved these changes
Jul 2, 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.
Change Summary
The MPMC variant of the shared channel called flume's synchronous
send()/recv()from inside
async fn, which parks the underlying Tokio worker thread instead ofyielding cooperatively. On a current-thread runtime where a producer and consumer
share the worker, this can deadlock; on multi-threaded runtimes it causes head-of-line
blocking and reduced throughput.
What issue does this PR close?
How are these changes tested?
Regression test added and passed locally.
Are there any user-facing changes?
Changelog
.chloggen/*.yamlentrychore(indicated in title)