[release/5.0] Take SuppressGCTransition into account in IL stub caching - #47619
Merged
Anipik merged 1 commit intoFeb 10, 2021
Merged
Conversation
* Use updated stub flags (taking into account SuppressGCTransition) when caching * Add tests
elinor-fung
force-pushed
the
stubCache-suppressGCTransition-port
branch
from
January 29, 2021 05:12
bd0d1e8 to
f905afd
Compare
This was referenced Jan 29, 2021
AaronRobinsonMSFT
approved these changes
Jan 29, 2021
jeffschwMSFT
approved these changes
Jan 29, 2021
jeffschwMSFT
left a comment
Member
There was a problem hiding this comment.
Approved. We will take for consideration in .NET 5.0.x
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.
Issue: #46184
Fix in master: #47320
This is a stripped down version of the fix that went into master and the change it depended on: adds the
NDIRECTSTUB_FL_SUPPRESSGCTRANSITIONflag, updates the P/Invoke stub flags based onSuppressGCTransition, and uses the updated flags in the IL stub cache.Customer Impact
When this issue results in the runtime suppressing the GC transition for P/Invokes that should not have them suppressed, users may hit GC starvation, data corruption, or runtime termination. When the runtime doesn't suppress the transition when it should, users will miss getting the performance benefits expected from suppressing the transition.
This is difficult to diagnose and does not have a reasonable workaround (only options would be to never use
SuppressGCTransitionor to re-work P/Invokes such that they do not have the same signature).Example based on the customer-reported issue:
Testing
Tests added to verify that P/Invokes with the same signature, differing only in
SuppressGCTransition, do not re-use the same IL stub.Risk
This is a fairly targeted fix, but it does affect IL stub caching and the stub flags used during generation,
Regression
No.
SuppressGCTransitionwas introduced in 5.0.