Skip to content

test: the harness runs synchronous cleanup work on a dedicated thread - #767

Merged
Blind-Striker merged 2 commits into
masterfrom
test/758-no-pool-blocking
Nov 3, 2026
Merged

Blind-Striker merged 2 commits into
masterfrom
test/758-no-pool-blocking

Conversation

@Blind-Striker

@Blind-Striker Blind-Striker commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

What

This brings more of #758's sites in line with testing-style.md's rule that a test doesn't block a thread-pool thread on a release another pool item must perform. Test code only, with no product change.

Part of #758.

  • Moved to a dedicated thread:
    • The harness starts its cleanup operations, OwnedCleanup's budget cancellation and OwnedEventReader's window cancellation on DedicatedThread.Run. That clears sites 1-4 in Tests that block a pool thread on a pool item's release #758's table: the stalled cleanup cancellation, the blocked invocation, the event-reader cancellation, and the diagnostic-write barrier.
    • The readiness row's expiry (OpenCodeServerReadinessTests.cs:94), which clears both teardown gates. A review found the test's own Task.Run put those gates on the pool, not the product.
  • DedicatedThread.Run(Action): a new overload, so the two cancellations stay method groups as before.
  • Reasons recorded, as one comment line at each site the rule's exception covers: OwnedServerChildTests.cs:73 and :358, TerminalSocketCoreRentedSendTests.cs:198, and TerminalSocketCoreTests.cs:147.
  • Left alone: the expiry row, retried at .NET 11 GA (see Tests that block a pool thread on a pool item's release #758).

Checks

  • Windows gate, static and tests parts, on this commit: 13,375 of 13,375.
  • The readiness gate's placement, probed: a throwaway check at the gate that throws on a pool thread never fired, on net10.0 and on net472.
  • Mutants:
Mutant Rows net10.0 net472
A caller cancel beats the readiness timeout (OpenCodeServer.Launcher.cs) StartAsync_Should_Keep_A_Readiness_Timeout_When_The_Caller_Cancels_During_Teardown Killed Killed
A late cleanup failure isn't observed (OwnedCleanup.cs) Sites 1, 2 and 4, plus four other cleanup rows Killed Killed

A finding this doesn't fix

Under the second mutant, OwnedEventReaderTests.CompleteAsync_Should_Bound_Stalls_Reach_Removal_And_Attach_Late_Failures hangs instead of failing, and the test host never ends. A hang dump named that row as the only test still running after 2 minutes. The same happens at master, before this change. So the row is missing a bound on that path: a hang guard, not a kill. It's recorded on #758.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

The cleanup rows' blocking callbacks no longer hold a pool thread, and the sites the product
places on the pool record why. Refs #758.
@Blind-Striker
Blind-Striker added this pull request to the merge queue Nov 3, 2026
Merged via the queue into master with commit 31ff4a6 Nov 3, 2026
14 checks passed
@Blind-Striker
Blind-Striker deleted the test/758-no-pool-blocking branch November 3, 2026 17:32
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