Repository navigation
Fix ControlledExecution.Run abort behavior on Linux and macOS - #136882
Merged
Merged
Conversation
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/runtime-infrastructure |
Co-authored-by: jkotas <[email protected]>
Co-authored-by: jkotas <[email protected]>
jkotas
reviewed
Nov 3, 2026
Co-authored-by: jkotas <[email protected]>
jkotas
reviewed
Nov 3, 2026
Co-authored-by: jkotas <[email protected]>
jkotas
reviewed
Nov 3, 2026
Co-authored-by: jkotas <[email protected]>
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @VSadov |
jkotas
requested review from
VSadov and
janvorli
and
a balanced review from Copilot
November 3, 2026 03:45
jkotas
approved these changes
Nov 3, 2026
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The Unix signal-mask changes interact with GC/debugger activation and require platform/runtime validation beyond the available static review and Linux-only execution report.
No open issues 🎉
What changed in this PR
This PR addresses repeated ControlledExecution.Run cancellation failures on Linux and macOS by restoring activation state before CoreCLR dispatches a thread-abort exception.
Changes:
- Clear the pending-activation flag and unblock the activation signal before abort dispatch bypasses normal cleanup.
- Add a process-isolated regression test that cancels execution three times on the same thread and checks each exception’s cancellation token.
| File | Description |
|---|---|
| src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/ControlledExecutionTests.cs | Adds regression coverage for repeated cancellation on one thread. |
| src/coreclr/vm/threadsuspend.cpp | Resets Unix activation state before thread-abort dispatch. |
Review effort: Balanced
BrzVlad
added a commit
that referenced
this pull request
Nov 10, 2026
Branching to the same instruction was not detected as an backwards branch, so we didn't generate a safepoint. This means that a thread running this loop couldn't be aborted and, worse than this, it would prevent the app from ever stopping for GC. Should fix `CancelRepeatedlyOnSameThread`, recently introduced in #136882
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.
Abort exception dispatch bypasses normal signal-handler return, leaving the activation signal blocked. It also bypasses the destructor that clears
m_hasPendingActivation, causing subsequent abort requests to suppress signal delivery.Fixes #136873