Skip to content

fix(dfir_pipes): resolve_futures poll_ready blocking multiple pending futures, fix #2662#2663

Draft
MingweiSamuel wants to merge 1 commit intomainfrom
mingwei/fix-2662
Draft

fix(dfir_pipes): resolve_futures poll_ready blocking multiple pending futures, fix #2662#2663
MingweiSamuel wants to merge 1 commit intomainfrom
mingwei/fix-2662

Conversation

@MingweiSamuel
Copy link
Copy Markdown
Member

In ResolveFutures::poll_ready, the call to empty_ready would return Pending when the queue contained unresolved futures in blocking mode (no subgraph_waker). This prevented callers from ever calling start_send to add new futures, effectively serializing the queue to one future at a time.

The fix makes poll_ready always return Done after opportunistically draining any ready futures. The Pending behavior is preserved in poll_flush, which correctly blocks until all futures resolve before flushing downstream.

Changes:

  • dfir_pipes/src/push/resolve_futures.rs:
    • poll_ready now discards the empty_ready result and always returns Done, allowing callers to keep adding futures to the queue.
    • Added regression test poll_ready_allows_send_while_futures_pending that uses a two-poll future to verify poll_ready doesn't block.
    • Updated comment on the Pending branch in empty_ready to clarify it's only relevant for poll_flush.

Copilot AI review requested due to automatic review settings March 18, 2026 20:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes ResolveFutures push operator readiness semantics so pending futures in “blocking mode” (no subgraph_waker) don’t cause poll_ready to return Pending, which previously prevented start_send from being called and effectively serialized the queue.

Changes:

  • Update ResolveFutures::poll_ready to opportunistically drain ready outputs but always return Done.
  • Clarify the Poll::Pending behavior in empty_ready as being relevant to poll_flush’s blocking semantics.
  • Add a regression test ensuring poll_ready remains Done while futures are pending.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread dfir_pipes/src/push/resolve_futures.rs
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Mar 18, 2026

Deploying hydro with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5e54692
Status: ✅  Deploy successful!
Preview URL: https://f94c0557.hydroflow.pages.dev
Branch Preview URL: https://sandbox-ed7cc062-2e2e-4e04-8.hydroflow.pages.dev

View logs

@MingweiSamuel MingweiSamuel changed the title fix(dfir_pipes): resolve_futures poll_ready blocking multiple pending futures (#2662) fix(dfir_pipes): resolve_futures poll_ready blocking multiple pending futures, fix #2662 Mar 18, 2026
@MingweiSamuel MingweiSamuel force-pushed the mingwei/fix-2662 branch 3 times, most recently from 3182f00 to 9bfd3d3 Compare March 18, 2026 21:49
In `ResolveFutures::poll_ready`, the call to `empty_ready` would return
`Pending` when the queue contained unresolved futures in blocking mode
(no subgraph_waker). This prevented callers from ever calling `start_send`
to add new futures, effectively serializing the queue to one future at a
time.

The fix makes `poll_ready` always return `Done` after opportunistically
draining any ready futures. The `Pending` behavior is preserved in
`poll_flush`, which correctly blocks until all futures resolve before
flushing downstream.

Changes:
- `dfir_pipes/src/push/resolve_futures.rs`:
  - `poll_ready` now discards the `empty_ready` result and always returns
    `Done`, allowing callers to keep adding futures to the queue.
  - Added regression test `poll_ready_allows_send_while_futures_pending`
    that uses a two-poll future to verify `poll_ready` doesn't block.
  - Updated comment on the `Pending` branch in `empty_ready` to clarify
    it's only relevant for `poll_flush`.


Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@shadaj
Copy link
Copy Markdown
Member

shadaj commented Mar 18, 2026

We need to think about this more carefully. If the future has a side effect it is important that they run sequentially and never concurrently.

@shadaj shadaj marked this pull request as draft March 18, 2026 23:23
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