Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Deadlock in loader lock (CoreCLR) from background GC in XAML apps #114182

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

Closed
Tracked by #114179
Sergio0694 opened this issue Apr 2, 2025 · 12 comments
Closed
Tracked by #114179

Deadlock in loader lock (CoreCLR) from background GC in XAML apps #114182

Sergio0694 opened this issue Apr 2, 2025 · 12 comments
Labels
area-GC-coreclr needs-author-action An issue or pull request that requires more info or actions from the author. no-recent-activity partner-impact This issue impacts a partner who needs to be kept updated

Comments

@Sergio0694
Copy link
Contributor

Sergio0694 commented Apr 2, 2025

Description

We're hitting random hangs in the Microsoft Store in debug builds on CoreCLR.

Context from @hoyosjs:

"This is a loader lock deadlock
[...]

  • Thread 3 tries to do a GC from the added pressure, which tries to start the background GC thread.
  • BG thread (and a ton of others) fail to start - they are stuck in LdrpInitializeThread on LdrpAcquireLoaderLock
  • They can't start bc thread 16 has the lock (LdrShutdownThread) and it's doing TLS destruction. Part of it must happen in COOP GC. Transitioning to coop means it waits for the original GC...

Crash dump (MSFT only): loader_hang_dmp.zip

Reproduction Steps

It just happens when using the app for a while.

Configuration

  • .NET 9.0.202
@Sergio0694 Sergio0694 added the partner-impact This issue impacts a partner who needs to be kept updated label Apr 2, 2025
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Apr 2, 2025
@jkotas
Copy link
Member

jkotas commented Apr 3, 2025

Duplicate of #110350 . cc @VSadov

@jkotas jkotas added the needs-author-action An issue or pull request that requires more info or actions from the author. label Apr 3, 2025
@jkotas
Copy link
Member

jkotas commented Apr 3, 2025

@Sergio0694 Could you please validate that it is fixed in 9.0.5?

(backport PR #113055)

@Sergio0694
Copy link
Contributor Author

Oh that's nice! I can try, yes, though it might be slightly tricky as I can't repro this myself.
Just to confirm, is this only affecting CoreCLR, or does this affect Native AOT as well?

@VSadov
Copy link
Member

VSadov commented Apr 3, 2025

Yes, this looks like #110350 . The fix has been backported to 9.0, but may not be available till the next servicing release.
As Jan suggested - it would be very helpful if you could try with 9.0.5 bits (i.e. #113055)

@dotnet-policy-service dotnet-policy-service bot removed the needs-author-action An issue or pull request that requires more info or actions from the author. label Apr 3, 2025
@jkotas
Copy link
Member

jkotas commented Apr 3, 2025

Just to confirm, is this only affecting CoreCLR, or does this affect Native AOT as well?

It does not affect Native AOT. The fix was to switch regular CoreCLR to how Native AOT works.

@Sergio0694
Copy link
Contributor Author

Perfect, thank you for confirming! At least we know this only affects our dev inner loop then 🙂

@mangod9 mangod9 removed the untriaged New issue has not been triaged by the area owner label Apr 3, 2025
@mangod9 mangod9 added this to the 10.0.0 milestone Apr 3, 2025
@VSadov
Copy link
Member

VSadov commented Apr 3, 2025

NativeAOT had a remotely related issue, fixed in #113194

But that is related to COM and is pretty hard to observe, even intentionally.
It would not show up as a deadlock though. In fact, in most cases it would not have any adverse effects, so is unlikely to bother you.

@jkotas jkotas added the needs-author-action An issue or pull request that requires more info or actions from the author. label Apr 7, 2025
@Sergio0694
Copy link
Contributor Author

I assume I can test the fix by installing the latest nightly SDK from the 9.0 branch from the SDK repo?

@dotnet-policy-service dotnet-policy-service bot added needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration and removed needs-author-action An issue or pull request that requires more info or actions from the author. labels Apr 7, 2025
@jkotas
Copy link
Member

jkotas commented Apr 7, 2025

Yes, you can do that if you do not want to wait for official release.

@jkotas jkotas added needs-author-action An issue or pull request that requires more info or actions from the author. and removed needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration labels Apr 7, 2025
Copy link
Contributor

This issue has been marked needs-author-action and may be missing some important information.

Copy link
Contributor

This issue has been automatically marked no-recent-activity because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove no-recent-activity.

Copy link
Contributor

This issue will now be closed since it had been marked no-recent-activity but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.

@dotnet-policy-service dotnet-policy-service bot removed this from the 10.0.0 milestone May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-GC-coreclr needs-author-action An issue or pull request that requires more info or actions from the author. no-recent-activity partner-impact This issue impacts a partner who needs to be kept updated
Projects
None yet
Development

No branches or pull requests

4 participants