[release/9.0-staging] [mono][sgen] Add option to disable tarjan gc bridge optimization #121376
+4
−2
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.
Backport of #121243 to release/9.0-staging
/cc @BrzVlad
Customer Impact
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
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.