Skip to content
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

[release/9.0] Reduce funceval abort #108256

Merged
merged 2 commits into from
Sep 27, 2024

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 25, 2024

Backport of #108220 to release/9.0

/cc @noahfalk

Customer Impact

  • Customer reported
  • Found internally

When debugging with Visual Studio (or another debugger that uses func-evals), the debugger may fail to complete some evals because the debuggee code deadlocks. Unless the user chooses to slip all threads they will be unable to see the eval results in the debugger. This issue is timing dependent so statistically some fraction of eval attempts fail without being able to easily predict which ones.

Historically this chance of failure has always been part of func-eval design, but we try to keep the success rate reasonably high by investigating and resolving any deadlocks that are encountered frequently in testing.

Regression

  • Yes
  • No

The deadlock being fixed here has always been possible but the frequency of hitting it has increased in .NET 9. We don't know what caused the increase in frequency - it could be many different factors since the underlying issue requires holding a specific lock during a race window.

Testing

I verified in a debugger that the locks are now taken in the order we desire, preventing a deadlock waiting on this particular lock. Tom re-ran the Visual Studio tests and confirmed this issue no longer occurred. He did encounter another issue which we believe is pre-existing but he is investigating further to confirm that.

Risk

Low. The change touches very little code and swaps the order we take two locks. The ReadyToRun lock where the ordering is being changed is not acquired in any other code path so there is no opportunity for a 2nd path to use a different ordering and create a deadlock.

Visual Studio reported that they were seeing unnecessary func-eval aborts. This was due to a lock ordering issue between CrstReadyToRunEntryPointToMethodDescMap and the coop mode transition. Flipping the ordering should fix the issue for this particular lock though it doesn't prevent any other lock from blocking func-evals. This should reduce, but not eliminate, the number of cases where func-eval abort is required.
Copy link
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@jeffschwMSFT jeffschwMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. we will take for consideration in 9 GA

@jeffschwMSFT jeffschwMSFT added the Servicing-consider Issue for next servicing release review label Sep 26, 2024
@tommcdon tommcdon added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Sep 27, 2024
@jeffschwMSFT jeffschwMSFT merged commit 3fed4b3 into release/9.0 Sep 27, 2024
11 of 16 checks passed
@hoyosjs hoyosjs deleted the backport/pr-108220-to-release/9.0 branch September 27, 2024 20:48
@github-actions github-actions bot locked and limited conversation to collaborators Oct 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-VM-coreclr Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants