Skip to content
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

In conservative mode RedirectedThreadFrame should report registers to GC. #48923

Merged
5 commits merged into from
Mar 2, 2021

Conversation

VSadov
Copy link
Member

@VSadov VSadov commented Mar 1, 2021

When a thread is redirected, its registers are stored in a context structure that is not on the stack.
The registers may contain managed roots and not reporting them to GC can cause crashes when running in conservative mode.

@ghost
Copy link

ghost commented Mar 1, 2021

Tagging subscribers to this area: @dotnet/gc
See info in area-owners.md if you want to be subscribed.

Issue Details

When thread is redirected, its registers are in a context structure that is not on the stack.
The registers may have managed roots and not reporting them to GC can cause crashes when running in conservative mode.

Author: VSadov
Assignees: -
Labels:

area-GC-coreclr

Milestone: -

@mangod9
Copy link
Member

mangod9 commented Mar 1, 2021

was this found via a stress test or a CR?

@VSadov
Copy link
Member Author

VSadov commented Mar 1, 2021

If you run GC\Stress\Framework\ReliabilityFramework test with set COMPlus_gcConservative=1, it will crash in about a minute due to this.

We do not generally test conservative mode. That is mostly for platform bring-up purposes. Or when investigating bugs, it can be enabled to rule out issues with gc root tracking (since it does not use any of that).

It is supposed to work though. I guess - who uses it, fixes it.

@@ -65,7 +65,7 @@ class GCConfigStringHolder
#define GC_CONFIGURATION_KEYS \
BOOL_CONFIG (ServerGC, "gcServer", NULL, false, "Whether we should be using Server GC") \
BOOL_CONFIG (ConcurrentGC, "gcConcurrent", NULL, true, "Whether we should be using Concurrent GC") \
BOOL_CONFIG (ConservativeGC, "gcConservative", NULL, false, "Enables/Disables conservative GC") \
BOOL_CONFIG (ConservativeGC, "gcConservative", NULL, true, "Enables/Disables conservative GC") \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I temporarily enabled conservative GC by default - for a CI run. That is not a part of the fix, just for test coverage. I will undo config changes.

@VSadov
Copy link
Member Author

VSadov commented Mar 2, 2021

The CI run with conservative mode enabled by default has some failures.
However every failure I looked at was in a test that relies on precise GC (i.e. postmortem finalization, collectible assemblies, COM wrappers, etc). Such failures are bydesign in conservative mode.

There are no random crashes anymore though.

I also ran GC\Stress\Framework\ReliabilityFramework locally (x64/Release) for about 15 minutes and it did not fail, which indicates that the original crash is gone.

@VSadov VSadov marked this pull request as ready for review March 2, 2021 01:34
@VSadov
Copy link
Member Author

VSadov commented Mar 2, 2021

@jkotas @davidwrighton - a fairly small change. Could you take a look?

The failures in tests are expected. They basically show that conservative mode works as expected.
The failures will be gone once I undo test-only config changes.

@VSadov
Copy link
Member Author

VSadov commented Mar 2, 2021

Thanks!!

@ghost
Copy link

ghost commented Mar 2, 2021

Hello @VSadov!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 51e2556 into dotnet:main Mar 2, 2021
@VSadov VSadov deleted the consReg branch March 2, 2021 04:19
@ghost ghost locked as resolved and limited conversation to collaborators Apr 1, 2021
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants