Skip to content

test(terminal): the queued-send expiry row holds its first send on a dedicated thread (#758) - #839

Merged
Blind-Striker merged 1 commit into
masterfrom
test/758-expiry-row-dedicated-thread
Nov 14, 2026
Merged

Blind-Striker merged 1 commit into
masterfrom
test/758-expiry-row-dedicated-thread

Conversation

@Blind-Striker

Copy link
Copy Markdown
Collaborator

The queued-send expiry row no longer blocks a thread-pool thread on a release that a test continuation performs, as testing-style.md requires.

Refs #758

What changes

Only TerminalSocketCoreTests.SendAsync_Should_Expire_A_Queued_Call_Without_Closing_The_Socket:

  • The first call runs on a dedicated thread (DedicatedThread.Run). Its substituted physical send blocks on a ManualResetEventSlim and returns a completed task. The core's await of a completed task continues inline, so the post-send hold (OnSent) stays on that dedicated thread instead of a pool thread.
  • The recorded scripted send reaches the test through a TaskCompletionSource<Task>. The scripted socket signals SendEntered before the send call returns, so a field the substitute assigns could be read before it is set. This also removes an unordered cross-thread read of that field from the old row.
  • Only the first call (the TrySetResult winner) holds. The finally releases the physical hold before it awaits anything that can throw.
  • Two new assertions:
    • OnSent ran off the pool. This fails on the base row: IsThreadPoolThread was True on net10.0, net11.0 and net472.
    • The physical hold was released within its guard.
  • Every existing assertion and clock step is unchanged.

The analyzer crash that blocked this form on NetAnalyzers 10.0.402 is gone with 11.0.100 (#838).

A property this row keeps

With a mutant that stops a queued call from expiring, the row fails at released after the hang guard, not at its expiry assertion. The base row and the changed row fail identically, at about 30.1 s on each target framework. The row awaits the queued call before it releases the first hold, so this predates the change. It is recorded on #758.

Verification

  • The full Windows gate at 305b4336, before the rebase onto e8b3164b, SDK 11.0.100:
    • Static part: GATE PASS on every step, slopwatch and the clone gate included.
    • Tests part: 15,521 of 15,521; the service-election leg 27 of 27.
  • After the rebase onto e8b3164b (a8668285): the Release build has 0 warnings and 0 errors; the TerminalSocketCoreTests class passed 3 runs, 78 of 78 each.
  • The test class repeated: 20 consecutive runs on the original commit and 10 on the amended one, 78 of 78 each time.
  • CI on all three operating systems: this PR's run.

…dedicated thread (#758)

The row held the first call's post-send step on a pool thread, released by a test continuation.
The first call now runs on a dedicated thread, and its physical send holds synchronously and
returns a completed task, so the post-send hold stays on that thread. The row asserts that the
hold ran off the pool and that the physical hold was released inside its guard.
@Blind-Striker Blind-Striker added this to the 1.1.0 milestone Nov 14, 2026
@Blind-Striker
Blind-Striker added this pull request to the merge queue Nov 14, 2026
Merged via the queue into master with commit 5abadd3 Nov 14, 2026
15 checks passed
@Blind-Striker
Blind-Striker deleted the test/758-expiry-row-dedicated-thread branch November 14, 2026 14:46
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