-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add NoInlining and NoOptimization attributes to ClearWaitSleepJoinState method #122652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…te method Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
src/coreclr/System.Private.CoreLib/src/System/Threading/Thread.CoreCLR.cs
Outdated
Show resolved
Hide resolved
|
/azp run runtime-coreclr gcstress-extra |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
|
cc @dotnet/jit-contrib This is causing a lot of noise in GC stress. Suppressing optimizations as a quick workaround. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements a temporary workaround for issue #122479 by disabling compiler optimizations on the ClearWaitSleepJoinState() method to prevent runtime failures related to thread state transitions.
Key changes:
- Added
MethodImplattribute withNoInlining | NoOptimizationflags to prevent problematic compiler optimizations - Added explanatory comment linking to the tracked issue
Description
Temporary workaround for issue #122479 by marking
Thread.ClearWaitSleepJoinState()withMethodImplOptions.NoInlining | MethodImplOptions.NoOptimizationto prevent compiler optimizations that trigger the underlying issue.Changes:
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]toClearWaitSleepJoinState()insrc/coreclr/System.Private.CoreLib/src/System/Threading/Thread.CoreCLR.csCustomer Impact
Without this fix, customers may experience runtime failures related to thread wait/sleep/join state transitions under specific optimization scenarios.
Regression
No - this is a workaround for an existing issue, not a regression fix.
Testing
Risk
Low. The change is minimal (3 lines) and only disables optimizations for a single internal method. This reduces performance optimization potential for this specific method but has no functional impact. The attributes are defensive and prevent the compiler from introducing problematic optimizations.
Original prompt
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.