Skip to content

Fix net48 deadlock test hang: use dedicated thread instead of signal-based synchronization - #157

Merged
jpablo2002 merged 1 commit into
microsoft:mainfrom
juanpacostaaa:fix-net48-deadlock-test-sleep
Jul 29, 2026
Merged

Fix net48 deadlock test hang: use dedicated thread instead of signal-based synchronization#157
jpablo2002 merged 1 commit into
microsoft:mainfrom
juanpacostaaa:fix-net48-deadlock-test-sleep

Conversation

@juanpacostaaa

Copy link
Copy Markdown
Contributor

The deadlock regression tests hang on .NET Framework 4.8 in ADO CI. Two signal-based approaches failed:

The fundamental issue is that .NET has no API to observe when a thread is blocked on a specific lock. On net48, any monitoring callback registered on the same CancellationToken fires before the SSH callback starts, so signal-based coordination is impossible without modifying production code.

Fix: Replace with new Thread(() => Cancel()) + Thread.Sleep(200). The dedicated thread eliminates pool dependency, and the 200ms wait provides a safety margin for the callback to reach lock contention.

…k test

Use a dedicated thread for Cancel() with a brief sleep instead of MRES
dual-registration, which hangs on .NET Framework 4.8 CI agents due to
callback-ordering differences (LIFO vs FIFO) and thread-pool pressure.
@jpablo2002 jpablo2002 self-assigned this Jul 29, 2026
@jpablo2002
jpablo2002 merged commit bc100e4 into microsoft:main Jul 29, 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.

4 participants