Repository navigation
test(terminal): the queued-send expiry row holds its first send on a dedicated thread (#758) - #839
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The queued-send expiry row no longer blocks a thread-pool thread on a release that a test continuation performs, as
testing-style.mdrequires.Refs #758
What changes
Only
TerminalSocketCoreTests.SendAsync_Should_Expire_A_Queued_Call_Without_Closing_The_Socket:DedicatedThread.Run). Its substituted physical send blocks on aManualResetEventSlimand 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.TaskCompletionSource<Task>. The scripted socket signalsSendEnteredbefore 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.TrySetResultwinner) holds. Thefinallyreleases the physical hold before it awaits anything that can throw.OnSentran off the pool. This fails on the base row:IsThreadPoolThreadwasTrueon net10.0, net11.0 and net472.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
releasedafter 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
305b4336, before the rebase ontoe8b3164b, SDK11.0.100:e8b3164b(a8668285): the Release build has 0 warnings and 0 errors; theTerminalSocketCoreTestsclass passed 3 runs, 78 of 78 each.