Skip to content

fix(networking): complete silo handshake before publication - #11447

Merged
ReubenBond merged 4 commits into
dotnet:mainfrom
ReubenBond:rb-11446-metadata-convergence-timeouts
Oct 8, 2026
Merged

ReubenBond merged 4 commits into
dotnet:mainfrom
ReubenBond:rb-11446-metadata-convergence-timeouts

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Problem

Both #11446 and #11434 retain a system RPC timeout immediately after an in-memory silo connection closes during startup. The metadata failure also records a connection rejection and a failed preamble write; the Cosmos failure records the same startup connection-close pattern before GetSiloManifestHash times out.

SiloConnection publishes itself to ConnectionManager from the peer-preamble read continuation. That continuation can run before the local preamble write is even queued, allowing concurrent senders to enqueue framed messages ahead of the protocol preamble.

The cancellation audit also found that TLS connector/listener tokens stopped at the underlying transport's creation or acceptance. Authentication used only its own handshake timeout. Controlled client-write, client-read, and server-read cases all remained pending after establishment cancellation when that timeout was infinite.

Solution

Publish the connection after both preamble operations complete: peer identity and cluster validation, and the local preamble write. Preserve the existing connection-establishment admission and shutdown paths.

Flow the outbound shutdown/deadline token and inbound listener shutdown token through connection runners and protocol initialization. Check cancellation before readiness publication. Pass connector/listener tokens into TLS startup and link authentication to establishment cancellation, underlying transport closure, and the existing handshake timeout. Keep authentication cancellation scoped to initialization; established connections retain their existing lifetime ownership.

Honor pre-canceled TCP, Unix, and in-memory listener binds before allocating or registering an endpoint. Schedule canceled startup attempts so they can complete accepted requests, and drain cleanup independently of the canceled establishment token before releasing buffers and transport resources.

Add deterministic inbound/outbound regressions for preamble ordering, failed writes, and cancellation before publication. Cover token identity, pre-canceled startup, established-connection lifetime, client/server TLS cancellation in read/write stages, queued-request completion, handshake-source detachment, and canceled binding resource ownership. Document the phase and ownership guarantees.

Extend the TLS end-to-end matrix to TCP, Unix-domain sockets, and in-memory transports, exercising all seven certificate and authentication-mode configurations over each transport.

Rationale

The controlled regression reproduces premature publication in both directions against the original implementation. Gating publication at the handshake boundary repairs the transport invariant shared by manifest and metadata retrieval while retaining their RPC deadlines, retry behavior, and exact convergence assertions.

The additional audit traces client, gateway, socket, Unix, in-memory, stream, and TLS paths. Client connections are published after initialization; gateways register clients after both preambles; TLS starts Orleans request processing after authentication. The silo publication repair applies to all these underlying transports through the shared SiloConnection implementation. No separate analogous publication defect was found.

Establishment cancellation now reaches the TLS handshake and protocol readiness boundary. Managers and listeners continue closing owned transports to interrupt pending preamble operations, preserving completion of accepted work and buffer ownership during cleanup.

The retained logs establish a common transport-failure signature, but do not capture the actual byte ordering of the historical failed connections. These investigations remain open for recurrence validation.

Addresses #11446 and #11434.

Microsoft Reviewers: Open in CodeFlow

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 focused implementation preserves lifecycle behavior and includes comprehensive deterministic regression coverage.

0 open findings

What changed in this PR

Delays silo connection publication until both handshake preambles complete, preventing framed messages from preceding the local protocol preamble.

Changes:

  • Moves connection publication after both preamble operations.
  • Adds inbound/outbound success and write-failure regression coverage.
  • Documents the handshake-ordering invariant.
File Description
src/​Orleans.Runtime/​Networking/​SiloConnection.cs Publishes only after handshake completion.
test/​Orleans.Core.Tests/​Networking/​ConnectionManagerTests.cs Adds deterministic ordering and cleanup tests.
docs/​site/​src/​content/​docs/​implementation/​messaging-networking.md Documents publication ordering.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI balanced review requested due to automatic review settings October 8, 2026 19:24

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 implementation correctly enforces preamble ordering with focused regression and transport coverage.

0 open findings

🧠 Review effort: Balanced

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Code coverage

Metric Pull request
Lines 83.35% (118,237 / 141,850)
Branches 72.88% (35,096 / 48,156)

Report-only conclusion: current-main baseline stale.

The newest successful coverage run tested ca862d8, not current main ab85a77.

Coverage combines every CI test matrix job, including providers, CodeGen, .NET 8/10, Linux, Windows, and macOS, using canonical physical source and branch identities.

The comparison remains report-only while normal line and branch variance is calibrated.

Coverage details

Copilot AI balanced review requested due to automatic review settings October 8, 2026 20:01

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 TLS BVT must skip Unix-socket cases on platforms without Unix-domain socket support.

1 open finding

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 8, 2026 20:11

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.

🔵 Needs a closer look

Core connection publication, cancellation, TLS, and cleanup concurrency changes warrant final human review despite strong regression coverage.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

@ReubenBond
ReubenBond merged commit c572586 into dotnet:main Oct 8, 2026
92 checks passed
@ReubenBond
ReubenBond deleted the rb-11446-metadata-convergence-timeouts branch October 8, 2026 20:55
ReubenBond added a commit to ReubenBond/orleans that referenced this pull request Oct 18, 2026
…pgrade test

RollingUpgrade_LocalToDistributed_NoErrors can fail its final no-error-log assertion when MembershipAgent.ValidateInitialConnectivity logs a transient, recoverable startup ping-retry failure (LogLevel.Error, event MembershipJoiningPreconditionFailure) during a newly-joining silo's pre-active connectivity check.

This is pre-existing MembershipAgent behavior, unrelated to recent PRs dotnet#11431/dotnet#11447/dotnet#11426/dotnet#10187/dotnet#10772: each retriable attempt logs at error level even when a subsequent retry succeeds and the connectivity-validation loop breaks cleanly. Only exhausted retries (MaxJoinAttemptTime elapsed) throw and fail silo startup, which would already fail this test before reaching its final assertion.

Add a narrow filter, consistent with the existing IsExpectedClientRoutingTableCancellation/IsExpectedDirectoryPartitionRejection filters, that excludes only this specific recovered-retry log line and surfaces the count/content of any filtered retries in test output for visibility.

Fixes dotnet#11444
ReubenBond added a commit to ReubenBond/orleans that referenced this pull request Oct 19, 2026
…pgrade test

RollingUpgrade_LocalToDistributed_NoErrors can fail its final no-error-log assertion when MembershipAgent.ValidateInitialConnectivity logs a transient, recoverable startup ping-retry failure (LogLevel.Error, event MembershipJoiningPreconditionFailure) during a newly-joining silo's pre-active connectivity check.

This is pre-existing MembershipAgent behavior, unrelated to recent PRs dotnet#11431/dotnet#11447/dotnet#11426/dotnet#10187/dotnet#10772: each retriable attempt logs at error level even when a subsequent retry succeeds and the connectivity-validation loop breaks cleanly. Only exhausted retries (MaxJoinAttemptTime elapsed) throw and fail silo startup, which would already fail this test before reaching its final assertion.

Add a narrow filter, consistent with the existing IsExpectedClientRoutingTableCancellation/IsExpectedDirectoryPartitionRejection filters, that excludes only this specific recovered-retry log line and surfaces the count/content of any filtered retries in test output for visibility.

Fixes dotnet#11444
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants