Skip to content

Fix .NET Framework 4.8 test hang in channel cancellation deadlock test - #156

Merged
jpablo2002 merged 1 commit into
microsoft:mainfrom
juanpacostaaa:fix/net48-test-mres
Jul 28, 2026
Merged

Fix .NET Framework 4.8 test hang in channel cancellation deadlock test#156
jpablo2002 merged 1 commit into
microsoft:mainfrom
juanpacostaaa:fix/net48-test-mres

Conversation

@juanpacostaaa

Copy link
Copy Markdown
Contributor

The deadlock regression test (OpenChannelCancelDuringConfirmationDoesNotDeadlock) hangs on .NET Framework 4.8 because TaskCompletionSource.TrySetResult() with RunContinuationsAsynchronously routes the Task.Wait() wake-up signal through the thread pool. When pool threads are occupied by SSH session async work, Wait() blocks indefinitely even though the TCS is logically complete.

This replaces TaskCompletionSource<bool> with ManualResetEventSlim, which signals the waiter directly via kernel event — zero thread pool dependency. The test logic and race setup are unchanged; it still deterministically validates the deadlock fix on both .NET 8 and .NET Framework 4.8.

…tEventSlim, which signals the waiter directly instead of routing through the thread pool.
@jpablo2002 jpablo2002 self-assigned this Jul 28, 2026
@jpablo2002
jpablo2002 merged commit 0151f1b into microsoft:main Jul 28, 2026
3 checks passed
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.

3 participants