Fix node message forwarding race#7942
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts node-to-node inbound message handling to avoid accessing handler pointers (notably consensus) during early startup states, addressing the race described in #7936 by gating message processing before dispatch.
Changes:
- Move the “can process inbound node message” gate to
NodeState::recv_node_inbound()so handler pointers aren’t touched until the node is in an active state. - Add
can_process_node_inbound_message(sm)helper and updaterecv_node_inbound_messageto assume the caller has already gated. - Update the C++ unit test to validate the gate predicate separately from dispatch behaviour.
Custom instructions used:
.github/copilot-instructions.md.github/instructions/reviewing.instructions.md
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/node/test/node_inbound_message.cpp |
Refactors the unit test to check gating predicate separately and verify dispatch for each message type. |
src/node/node_state.h |
Adds the startup-state gate in recv_node_inbound before calling into the dispatcher, preventing early handler pointer access. |
src/node/node_inbound_message.h |
Introduces can_process_node_inbound_message helper and removes internal gating from recv_node_inbound_message. |
achamayou
approved these changes
Jun 15, 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.
Failed in https://github.com/microsoft/CCF/actions/runs/27516961192/job/81327255271
As per #7936, there's early
consensus.ptr()deref, which is racing withsetup_consensus().