Uh oh!
There was an error while loading. Please reload this page.
Allocate static boxes on FOH #2 - #79188
Conversation
…holding level 4 lock CrstStaticBoxInit"
@jkotas maybe it rings a bell to you - so when I set My understanding that it happens because of |
jkotas
commented
Dec 3, 2022
AssemblyLoader can run arbitrary code (e.g. due to user overridable ResolveAssembly event). You do not want to be holding any runtime locks when the assembly loader runs. |
EgorBo
commented
Dec 4, 2022
@jkotas it looks like the issue is fixed via |
EgorBo
commented
Dec 4, 2022
/azp run runtime-coreclr outerloop, runtime-coreclr gcstress0x3-gcstress0xc |
|
Azure Pipelines successfully started running 2 pipeline(s). |
jkotas
commented
Dec 5, 2022
If it is the case, it means that |
| pResult->fieldLookup.addr = pField->GetStaticAddressHandle((void*)pField->GetBase()); | ||
| pResult->fieldLookup.accessType = IAT_VALUE; | ||
| GCPROTECT_BEGININTERIOR(pResult->fieldLookup.addr); |
There was a problem hiding this comment.
What guarantees that pResult->fieldLookup.addr is not going to move once it is return to the JIT?
There was a problem hiding this comment.
@jkotas I don't have a good explanation yet, what I understand so far:
GetGCStaticsBasePointeris assumed to be moveable already: https://github.com/dotnet/runtime/blob/main/src/coreclr/vm/methodtable.cpp#L3485- I thought that it supposed to return an address to a pinned area so that's how we can give it to JIT
but apparently it works differently for collectible contexts? And in case of collectible context is not supposed to be consumed by JIT (should go through theCORINFO_HELP_GETSHARED_GCSTATIC_BASE_DYNAMICCLASShelper) - the places where it's used already seem to be safe? because of COOP and nothing triggers GC (and e.g. BulkStaticsLogger::LogAllStatics() has GC_NOTRIGGER)
There was a problem hiding this comment.
Yes, the statics for collectible types do not seem to be pinned:
runtime/src/coreclr/vm/appdomain.cpp
Line 4184 in 1ad1022
I think that this means that we need to avoid giving the JIT address of the collectible type statics?
There was a problem hiding this comment.
I think that this means that we need to avoid giving the JIT address of the collectible type statics?
Looks like we already don't do it, at least we don't hit that path where we set the address.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
EgorBo
commented
Dec 6, 2022
Failures are #79255 |
Reverts 2nd part of #78296 revert.
NOTE: this doesn't fix the flaky NRE as I'm able to reproduce it locally