fix(daemon): increment pending counter when propagating NodeFailed downstream - #2829
Merged
trunk-io[bot] merged 1 commit intoJul 28, 2026
Merged
Conversation
…wnstream When an upstream node exited non-zero, the daemon enqueued a `NodeEvent::NodeFailed` into each downstream subscriber's channel without the matching `inc_pending()` that every other delivery site performs. The `Listener` still decrements the per-node `pending_messages` counter for every drained event (NodeFailed included), so the counter ended up one too low — and underflowed to `u64::MAX` when the receiver's channel was already empty. The bogus value was then reported to the coordinator (metrics / `dora node list`) until the node re-subscribed. Extract the propagation into `RunningDataflow::propagate_node_failed`, which pairs each successful enqueue with `inc_pending`, and add a regression test asserting the receiver's counter stays consistent after a NodeFailed propagation to an idle node. Fixes #2827 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CQi7Jq6ewwkjjskR7nmNgK
Contributor
|
😎 Merged successfully - details. |
Collaborator
Author
|
I reviewed this change and found no issues. I confirmed the bug and the fix against the surrounding code:
The regression test is meaningful: it drives the real propagation, asserts the counter reaches 🤖 This is a fully automated review by Claude. No human has verified these findings — please treat them as suggestions to check rather than confirmed defects. Generated by Claude Code |
phil-opp
marked this pull request as ready for review
July 28, 2026 13:12
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.
Summary
Fixes #2827.
When an upstream node exits with a non-zero code, the daemon propagates a
NodeEvent::NodeFailedto each downstream (subscriber) node. It enqueued that event into the subscriber's channel without the matchinginc_pending()that every other delivery site performs. The per-nodepending_messagescounter (anArc<AtomicU64>) is still decremented unconditionally by theListenerwhen it drains the event, so the counter ended up one lower than the true in-flight count — and if the subscriber's channel was already empty (counter== 0), thefetch_sub(1)wrapped tou64::MAX. The bogus value was then reported to the coordinator (metrics /dora node list) until the node re-subscribed.Change
NodeFailedpropagation loop out of theSpawnedNodeResulthandler inlib.rsinto a newRunningDataflow::propagate_node_failed(failed_node, error_msg, clock)method.send_with_timestamp(...).ok() == Some(true)) withinc_pending(&recv_id), mirroring every other delivery site in the daemon.propagate_node_failed_keeps_idle_receiver_counter_consistent) that drives asource → sinkmapping with an idle receiver, propagates aNodeFailed, then drains the event the way theListenerdoes (one unconditionalfetch_sub) and asserts the counter returns to0rather than underflowing tou64::MAX.Testing
cargo test -p dora-daemon— all 113 tests pass, including the new one.cargo fmt -p dora-daemon -- --checkandcargo clippy -p dora-daemon -- -D warningsare clean.Generated by Claude Code