-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Test failure: Loader\\CollectibleAssemblies\\ResolvedFromDifferentContext\\ResolvedFromDifferentContext\\ResolvedFromDifferentContext.cmd #68112
Comments
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov Issue Details
Fails for: Also fails with a different message:
for:
|
It looks like the fix in #67922 is sufficient for |
I have investigated the problem. It occurs when the managed It seems that a natural way to solve this issue would be to modify the GC I was also thinking that there might be a way to recreate the managed @jkotas do you happen to have some other idea on how to fix the problem? |
The unit of unloading is whole assembly. We do not support unloading of individual types from the assembly. This should work based on assembly references. When an assembly picks up a reference to collectible assembly, this reference should be added to the graph of loader allocators. Interfaces that happen to get resolved through this reference should be kept alive by virtue of being contained in assemblies represented in the graph. I do not think we want to be changing |
The references between the native loader allocators work fine, these were fixed by my previous change. The |
Is this only a problem with interfaces or it is more general problem of types materialized via reflection while not represented by any instances. I.E. can fetching type constraints of some type parameter also see these issues? |
Actually, I've just realized it would not work even if we made the changes in the GC related stuff I've mentioned. The issue is really with managed |
To be precise, it would happen in all cases when a reflection would return a type from a collectible ALC1 based on something from some ALC2. I am not sure what would be all the other cases besides the GetInterfaces. I'll take a look. |
Did we have this fundamental problem since forever or was it introduced by #67160? |
We did have a problem forever, but it would never be hit as the problem that #67160 fixed would hide it. I have looked more into it. It looks like the culprit for this issue is actually at a bit different place. The issue is that when my newly added fix calls It seems that ensuring that the managed |
Or anymore, which seems to be the case here - the |
I would expect that once |
The handle becomes NULL once there are no managed objects from the ALC. However, in the problematic case, there was only the managed Assembly containing definitions of the interface in that ALC (and the managed After looking more into it, it seems that a fix might be to also make |
Hmm, it should actually work fine, while the |
So I have a full understanding of how we get into the problematic state. The key thing is how the test loads the interface assembly. It creates the collectible ALC1 inside of the ALC.Load method of the other collectible ALC2, loads the interface assembly using that and returns the resulting assembly from the Load method. So when it returns, there are no more references to that ALC1. There is still a reference to the managed One way to fix that issue may be to move adding the reference between the native |
https://dev.azure.com/dnceng/public/_build/results?buildId=1721802&view=ms.vss-test-web.build-test-results-tab&runId=46735808&resultId=108688&paneView=debug
Fails for:
coreclr windows arm64 Checked gcstress0x3
coreclr Linux arm Checked gcstress0x3
coreclr OSX arm64 Checked gcstress0x3
coreclr Linux arm64 Checked gcstress0x3
coreclr Linux arm64 Checked gcstress0xc
coreclr Linux x64 Checked gcstress0xc
Also fails with a different message:
for:
coreclr windows x64 Checked gcstress0x3
coreclr windows x86 Checked gcstress0x3
The text was updated successfully, but these errors were encountered: