[wasm][coreclr] Do not use SetCleanupNeededForFinalizedThread#127562
Open
radekdoulik wants to merge 1 commit intodotnet:mainfrom
Open
[wasm][coreclr] Do not use SetCleanupNeededForFinalizedThread#127562radekdoulik wants to merge 1 commit intodotnet:mainfrom
radekdoulik wants to merge 1 commit intodotnet:mainfrom
Conversation
This avoids reaching assert in SetCleanupNeededForFinalizedThread as we don't have finalizer thread. CleanupFinalizedThreads is not reached anyway, because HaveExtraWorkForFinalizer is returning false on wasm. Thus DoExtraWorkForFinalizer is not called and so is not calling SetCleanupNeededForFinalizedThread either. Enable System.Threading.Thread tests
Contributor
|
Tagging subscribers to this area: @agocke |
jkotas
reviewed
Apr 29, 2026
| } | ||
|
|
||
| thread->SetThreadState(Thread::TS_Finalized); | ||
| #ifndef TARGET_WASM |
Member
There was a problem hiding this comment.
This should use FEATURE_MULTITHREADING
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a CoreCLR/WASM mismatch around Thread finalization: WASM doesn’t have a dedicated finalizer thread, so running Thread finalizers inline can trip IsFinalizerThread()-based assertions. It also re-enables System.Threading.Thread library tests for browser/CoreCLR by removing the project exclusion.
Changes:
- Guard
Thread::SetCleanupNeededForFinalizedThread()out onTARGET_WASMto avoid theIsFinalizerThread()assert duringThreadfinalization. - Re-enable
System.Threading.Thread.Testson browser/CoreCLR by removing its exclusion fromsrc/libraries/tests.proj.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/libraries/tests.proj |
Removes the browser/CoreCLR exclusion for System.Threading.Thread.Tests so the test project runs again. |
src/coreclr/vm/comsynchronizable.cpp |
Skips SetCleanupNeededForFinalizedThread() on WASM during ThreadNative::Finalize to avoid finalizer-thread assertions. |
| } | ||
|
|
||
| thread->SetThreadState(Thread::TS_Finalized); | ||
| #ifndef TARGET_WASM |
| @@ -185,8 +185,6 @@ | |||
|
|
|||
| <!-- https://github.com/dotnet/runtime/issues/125495 - These tests are disabled on browser/CoreCLR because of crashes and test failures. --> | |||
This was referenced Apr 30, 2026
Open
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.
Note
PR description generated with Copilot assistance.
On wasm there is no finalizer thread. GC finalizers run inline on the main thread, causing
SetCleanupNeededForFinalizedThreadto hit theIsFinalizerThread()assert when aThreadobject is finalized.The call to
CleanupFinalizedThreadsis not reached anyway becauseHaveExtraWorkForFinalizerreturns false on wasm.Also enable System.Threading.Thread tests on browser/CoreCLR.