Skip to content

Fix TcpBootstrap root rank validation and error handling - #951

Merged
Binyang Li (Binyang2014) merged 4 commits into
mainfrom
binyli/bootstrap
Nov 9, 2026
Merged

Binyang Li (Binyang2014) merged 4 commits into
mainfrom
binyli/bootstrap

Conversation

@Binyang2014

Copy link
Copy Markdown
Contributor

Summary

  • Validate that incoming ExtInfo.rank is within [0, nRanks_) and zero-initialize ExtInfo in TcpBootstrap::Impl::getRemoteAddresses.
  • Require exact message size matching in TcpBootstrap::Impl::netRecv.
  • Catch and ignore invalid peer check-in connections in TcpBootstrap::Impl::bootstrapRoot so transient or malformed connections do not abort the root thread.
  • Stop and join rootThread_ before resetting listenSockRoot_ in TcpBootstrap::Impl::close.
  • Add BootstrapTest.RejectInvalidRemoteAddresses unit test.

Copilot AI balanced review requested due to automatic review settings November 5, 2026 22:47
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Persistent local accept failures can trigger an unbounded retry loop with CPU and warning floods, while the undersized-message test does not detect regressions that accept complete short frames.

2 open issues
What changed in this PR

This PR hardens TCP bootstrap against malformed peer check-ins and improves root-thread shutdown ordering.

Changes:

  • Zero-initialize peer metadata, validate rank bounds, and require exact message sizes.
  • Ignore invalid check-in connections and join the root thread before releasing its listening socket.
  • Add a multi-process test covering malformed messages and invalid ranks.
File Description
test/​mp_unit/​bootstrap_tests.cc Adds invalid peer check-in coverage followed by normal bootstrap verification.
src/​core/​bootstrap/​bootstrap.cc Strengthens input validation, connection error handling, and shutdown ordering; corrects license-header capitalization.

Review effort: Balanced

Comment thread src/core/bootstrap/bootstrap.cc Resolved
Comment thread test/mp_unit/bootstrap_tests.cc Resolved
Follow-up to #951, based on `binyli/bootstrap`.

This minimal change migrates `bootstrap.cc` from `debug.h` to
`logger.hpp`, maps legacy `TRACE` diagnostics to `DEBUG(NET, ...)`, and
routes `Error` throws through `THROW(NET, ...)`. Bootstrap flow and
`ErrorCode` values are preserved; `THROW` adds logger metadata to thrown
error messages.

Validation completed: clang-format, diff whitespace, logger-macro
syntax, and patch applicability checks. Full build and bootstrap tests
were not run because no `nvcc`, `hipcc`, or CUDA runtime headers are
available; GPU execution was not authorized.
Copilot AI balanced review requested due to automatic review settings November 6, 2026 18:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The short-message test still passes with the old size check, leaving the regression undetected, and logging calls print pointer addresses instead of diagnostic text.

3 open issues

Review effort: Balanced

Comment thread src/core/bootstrap/bootstrap.cc Resolved
Propagate local accept failures while tolerating peer disconnects. Exercise complete undersized frames and preserve bootstrap diagnostic text.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 860254af-2a4e-4a97-a421-5ff6253c442f
Copilot AI balanced review requested due to automatic review settings November 6, 2026 19:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the TCP bootstrap validation and shutdown-safety changes.

No open issues 🎉

3 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 7, 2026 00:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The TcpBootstrap check-in hardening has no active review issues.

No open issues 🎉

Review effort: Balanced

@Binyang2014
Binyang Li (Binyang2014) merged commit 44a9565 into main Nov 9, 2026
17 checks passed
@Binyang2014
Binyang Li (Binyang2014) deleted the binyli/bootstrap branch November 9, 2026 00:42
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