Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Fix ILStubCache allocation for collectible assemblies #21188

Merged
merged 1 commit into from
Nov 28, 2018

Conversation

janvorli
Copy link
Member

The ILStubCache was being allocated per domain unless the domain was a
compilation AppDomain. This is wrong for collectible assemblies, since
after an assembly is collected, the cache keeps stale entries referring
to already deleted MethodTables.
The fix is to make ILStubChange per LoaderAllocator instead (and keep
the per module instances for compilation AppDomain).

@janvorli janvorli added this to the 3.0 milestone Nov 26, 2018
@janvorli janvorli self-assigned this Nov 26, 2018
@janvorli janvorli requested a review from jkotas November 26, 2018 10:07
@jkotas
Copy link
Member

jkotas commented Nov 26, 2018

and keep the per module instances for compilation AppDomain

Why do we need to keep the per AppDomain instance for compilation domain? Can everything use just the one on the LoaderAllocator?

@jkotas
Copy link
Member

jkotas commented Nov 26, 2018

Can we add regression test for this?

@janvorli
Copy link
Member Author

Why do we need to keep the per AppDomain instance for compilation domain?

I've said "per module", not per AppDomain. I don't actually know the reason why the compilation domain requires per module cache.

@jkotas
Copy link
Member

jkotas commented Nov 26, 2018

Just guessing ... maybe it was persisted by fragile NGen at some point in the past, but it is not today - there is "ZeroPointerField(this, offsetof(Module, m_pILStubCache))" in the fragile NGen path.

i would clean it up and just have the one on the LoaderAllocator.

@janvorli
Copy link
Member Author

Ok, sounds good.

As for the regression test, I have a COM interop test with unloadability enabled that serves as a regression test (I've hit it in when I wanted to add that test to the collectible COM interop enabling PR and so I had to temporarily remove it). I will add it again after this PR is merged either as part of the COM interop PR or as a separate PR.

@jkotas
Copy link
Member

jkotas commented Nov 26, 2018

Actually, the per-module cache may be needed for the appdomain cleanups that I am working on. I think this is good as is.

@janvorli
Copy link
Member Author

@dotnet-bot test Ubuntu x64 Checked Innerloop Build and Test

@janvorli
Copy link
Member Author

@dotnet-bot test Ubuntu x64 Checked Innerloop Build and Test (Jit - TieredCompilation=0) please

Copy link

@briansull briansull left a comment

Choose a reason for hiding this comment

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

Looks Good

@janvorli
Copy link
Member Author

@dotnet-bot test Ubuntu x64 Checked Innerloop Build and Test (Jit - TieredCompilation=0) please

The ILStubCache was being allocated per domain unless the domain was a
compilation AppDomain. This is wrong for collectible assemblies, since
after an assembly is collected, the cache keeps stale entries referring
to already deleted MethodTables.
The fix is to make ILStubChange per LoaderAllocator instead (and keep
the per module instances for compilation AppDomain).
@janvorli
Copy link
Member Author

@dotnet-bot test Ubuntu arm Cross Checked Innerloop Build and Test please

@janvorli
Copy link
Member Author

@dotnet-bot test this please

@janvorli
Copy link
Member Author

@dotnet-bot test Ubuntu arm Cross Checked Innerloop Build and Test please

@jkotas jkotas merged commit 8aa0869 into dotnet:master Nov 28, 2018
@janvorli janvorli deleted the fix-collectible-ilstub-cache branch November 28, 2018 14:19
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…#21188)

The ILStubCache was being allocated per domain unless the domain was a
compilation AppDomain. This is wrong for collectible assemblies, since
after an assembly is collected, the cache keeps stale entries referring
to already deleted MethodTables.
The fix is to make ILStubChange per LoaderAllocator instead (and keep
the per module instances for compilation AppDomain).

Commit migrated from dotnet/coreclr@8aa0869
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants