Runtime: [Linux] Segfault when AssemblyBuilder.DefineDynamicAssembly and PerfMap

Created on 25 Sep 2019  路  20Comments  路  Source: dotnet/runtime

Hi!
When I build app with final .NET Core v3.0.0 and run it with
COMPlus_PerfMapEnabled=1

static void Main(string[] args)
{
     AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Sth.dll"), AssemblyBuilderAccess.RunAndCollect);
}

I get instantly Segmentation fault.

It seems it is working fine on Preview9 (I was not testing any other versions).

It migh be related to Link

Fun fact,
with COMPlus_PerfMapEnabled=1
I get segfault for

dotnet new console
dotnet tool install -g dotnet-sos
That makes it real fun to diagnose.

Maybe this stack trace helps

frame #0: 0x00007f5a43d32caa libcoreclr.so`PerfInfo::LogImage(PEFile, char16_t) + 90
frame dotnet/coreclr#1: 0x00007f5a43d31e57 libcoreclr.so`PerfMap::LogImage(PEFile*) + 279
frame dotnet/coreclr#2: 0x00007f5a43e6c56a libcoreclr.so`Assembly::CreateDynamic(AppDomain, CreateDynamicAssemblyArgs) + 2538
frame dotnet/coreclr#3: 0x00007f5a43ec052a libcoreclr.so`AppDomainNative::CreateDynamicAssembly(AssemblyNameBaseObject, StackCrawlMark, int) + 234

Of course I can disable it, but this prevents me from profiling apps :-(

area-Tracing-coreclr

Most helpful comment

Bit of clarification, this looks like it's part of the newly-released 3.0.1 Runtime as described here: https://github.com/dotnet/coreclr/pull/26910 and here: https://github.com/dotnet/coreclr/issues?utf8=%E2%9C%93&q=milestone%3A3.0.1+label%3Aservicing-approved+sort%3Aupdated-desc

Thanks for the work, y'all!

All 20 comments

@janvorli @jkotas any thoughts?
@klesta490 does it happen on more than 1 machine? This is highly suspicious.

Cc @noahfalk

@jkotas any thoughts?

Plain vanilla bug in the PerfMap implementation.

does it happen on more than 1 machine? This is highly suspicious

It is 100% repro.

Likely introduced by https://github.com/dotnet/coreclr/pull/26403

cc @brianrob

I set 3.0.x so it doesn't get lost, feel free to change.

Yup, this was caused by dotnet/coreclr#26403. I am working on a fix.

cc @jeffschwMSFT for shiproom.

@brianrob Could you please prepare PR to back port this to 3.x ?

@brianrob we should consider this for 3.0.x servicing. Can you create a cheery picked PR against the release/3.0 and mark with label:ask-mode. We can then have it reviewed/approved by tactics.

cc @MeiChin-Tsai

Yup, I'm already doing that. Didn't mean to use the magic word to get GitHub to close this. Will post the PR shortly.

@jeffschwMSFT, I've posted dotnet/coreclr#26910 and marked it with label:ask-mode.

Is there any WA? I don't want to rebuild all images back to Preview9 :-/

The servicing fix is currently slated for 3.0.2. +@brianrob on any potential workarounds.

Unfortunately, I'm not aware of any workaround, short of not generating any dynamic assemblies.

@brianrob Can this be closed?

Yes, this has now been merged for 3.0.2.

Any idea when 3.0.2 will be released?

cc @leecow

3.0.2 will be out January.

Bit of clarification, this looks like it's part of the newly-released 3.0.1 Runtime as described here: https://github.com/dotnet/coreclr/pull/26910 and here: https://github.com/dotnet/coreclr/issues?utf8=%E2%9C%93&q=milestone%3A3.0.1+label%3Aservicing-approved+sort%3Aupdated-desc

Thanks for the work, y'all!

Was this page helpful?
0 / 5 - 0 ratings