Skip to content

test(hosting): mark the handoff request's arrival before the release closes it - #986

Merged
Blind-Striker merged 1 commit into
masterfrom
fix/pty-handoff-arrival-order
Nov 24, 2026
Merged

Blind-Striker merged 1 commit into
masterfrom
fix/pty-handoff-arrival-order

Conversation

@Blind-Striker

Copy link
Copy Markdown
Collaborator

Summary

ServicePtyHandoffTests.PrepareAsync_Should_Return_When_A_Concurrent_Caller_Published_A_Fresh_Matching_Sidecar failed once on net472 in run 45279094808, at the arrival assertion: "Expected to be true but found False".

The race. The first ticket request's handler:

  1. seeds the fresh sidecar;
  2. calls ReleaseResponses(), which closes every client socket, this request's included;
  3. only then returns Pending(arrived), which marks the arrival.

On net472 the handler does not retry a connection that closed without a response (the test's own #if NET note). So PrepareAsync could fail, re-check, find the fresh sidecar and return between steps 2 and 3. The test then saw the preparation finish before the arrival.

The fix is the test's ordering only. The handler reads whether this is the first request, builds the Pending(arrived) response that marks the arrival, and only then seeds and releases. There is no retry and no wider wait. The rest of the test, including the net retry assertion, is unchanged.

Test

  • Forced order, net472, as a scratch edit that is not committed: after the release, the handler holds until PrepareAsync has completed (bounded).
    • The old order fails with the CI message.
    • The new order passes with the same hold.
  • ServicePtyHandoffTests: 36 of 36 on net472, net10.0 and net11.0.
  • Full local gate on the rebased head.

…closes it

The concurrent-fresh-sidecar test released the held responses before it
marked the ticket request's arrival. On net472 the handler does not retry
a connection that closed without a response, so PrepareAsync could fail,
find the fresh sidecar and return before the arrival was marked, and the
arrival assertion read false. The response that marks the arrival is now
built before the release.
@Blind-Striker
Blind-Striker added this pull request to the merge queue Nov 24, 2026
Merged via the queue into master with commit 2ad7066 Nov 24, 2026
15 checks passed
@Blind-Striker
Blind-Striker deleted the fix/pty-handoff-arrival-order branch November 24, 2026 09:21
@Blind-Striker Blind-Striker mentioned this pull request Nov 24, 2026
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.

1 participant