[mono][sgen] Add option to disable tarjan gc bridge optimization#121243
Merged
BrzVlad merged 2 commits intodotnet:mainfrom Nov 5, 2025
Merged
[mono][sgen] Add option to disable tarjan gc bridge optimization#121243BrzVlad merged 2 commits intodotnet:mainfrom
BrzVlad merged 2 commits intodotnet:mainfrom
Conversation
This option is also currently causing crashes in the gc bridge.
Contributor
|
Tagging subscribers to this area: @BrzVlad |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request fixes an indexing bug in the Tarjan bridge color table dump function and adds a new GC parameter option for disabling non-bridge strongly connected components (SCCs).
- Fixed incorrect loop counter increment in
dump_color_tablefunction - Added support for
disable-non-bridge-sccGC parameter option
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/mono/mono/metadata/sgen-tarjan-bridge.c | Moved counter increment from outer loop to inner loop to correctly count color data entries instead of buckets |
| src/mono/mono/metadata/sgen-bridge.c | Added parameter handling for the disable-non-bridge-scc configuration option |
filipnavara
approved these changes
Oct 31, 2025
Member
Author
|
/ba-g android infra issue |
Member
Author
|
/backport to release/9.0-staging |
Contributor
|
Started backporting to |
Merged
4 tasks
BrzVlad
added a commit
that referenced
this pull request
Nov 6, 2025
…idge optimization (#121376) Backport of #121243 to release/9.0-staging /cc @BrzVlad ## Customer Impact - [x] Customer reported - [ ] Found internally Applications on maui-android can randomly crash during GC. We've had a few fixes for the tarjan bridge merged a few months ago, but there is still one more issue. The problem is caused by a specific optimization inside the tarjan gc bridge. The only workaround for a customer hitting this failure is to configure an environment variable so that their app uses a different gc bridge (which has worse performance). One customer reported that using the older gc bridge makes the application unusable due to degradation of performance. This PR allows users to opt out of a smaller optimization and keep using the tarjan gc bridge, as a workaround for .NET9. ## Regression - [ ] Yes - [x] No ## Testing Tested on our own gc bridge tests, with scenario causing the issue. ## Risk This PR has zero risk since it just adds support for disabling an optimization. By default, there is no change in behavior. I plan to backport to .NET10 the actual fix for this issue. --------- Co-authored-by: Vlad Brezae <brezaevlad@gmail.com>
BrzVlad
added a commit
to BrzVlad/runtime
that referenced
this pull request
Nov 10, 2025
…net#121243) This option is also currently causing crashes in the gc bridge.
4 tasks
steveisok
pushed a commit
that referenced
this pull request
Nov 10, 2025
…121483) Backport #121247 and #121243 to release/10.0. This fixes assertions like ``` * Assertion at /home/vbrezae/Xamarin/repos/runtime/src/mono/mono/metadata/sgen-tarjan-bridge.c:1151, condition `color_visible_to_client (cd)' not met ``` ## Customer Impact - [x] Customer reported - [ ] Found internally Some applications on maui-android can randomly crash during GC, when using the default gc bridge (the tarjan bridge). We've had a few fixes for the tarjan bridge merged a few months ago, but there is still this one issue. The workaround used by customers is to fallback to an older GC bridge which has worse performance. For some this performance impact is not acceptable. This backport also fixes the same issue in the CoreCLR gcbridge implementation. CoreCLR doesn't have a fallback GC bridge implementation, so this fix is essential for the successful use of CoreCLR/NativeAOT on android, at least for some customers. ## Regression - [ ] Yes - [x] No ## Testing Tested on our own gc bridge tests, with scenario causing the issue. ## Risk The GC bridge is a sensitive area and fixes here typically have some carried risk. This fix however is quite straightforward, it simply pins the value of a property inside an SCC node, rather than having it recomputed with unstable value that was leading to problems. No changes are done to the core algorithm. Low risk.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This option is also currently causing crashes in the gc bridge.