dotnet / diagnostics

This repository contains the source code for various .NET Core runtime diagnostic tools and documents.
MIT License
1.18k stars 354 forks source link

How to analyze .NET Core 2 Linux dump on Windows? #1494

Closed Aaronmsv closed 4 years ago

Aaronmsv commented 4 years ago

Hello, I would like to get some assistance on how to analyze a .NET Core 2.2.8 Linux dump on Windows with WinDbg. I'm not sure this is the right repository, but any help is appreciated.

I've worked with WinDbg multiple times in the past when the dump was generated on Windows and that worked fine, but I'm stuck with this Linux dump. Directly after opening the dump I get a very long list of warnings. This is a small snippet of that:

WARNING: System_Linq_Expressions overlaps System_Collections_Immutable
WARNING: System_Linq_Expressions overlaps _ce8e5dca_757f_41a9_a4b9_3df853b03a88_5_0
WARNING: System_Linq_Expressions overlaps _ce8e5dca_757f_41a9_a4b9_3df853b03a88_4_0
WARNING: System_Linq_Expressions overlaps _a8e271da_e0ca_4e7e_a433_ea4c99abbda3_6_0
WARNING: System_Linq_Expressions overlaps _5213e1b5_46ae_4332_9d07_1553ee0d54e5_15_0
WARNING: System_Linq_Expressions overlaps _5213e1b5_46ae_4332_9d07_1553ee0d54e5_14_0
WARNING: System_Linq_Expressions overlaps _5213e1b5_46ae_4332_9d07_1553ee0d54e5_13_0
WARNING: System_Linq_Expressions overlaps _5213e1b5_46ae_4332_9d07_1553ee0d54e5_12_0
WARNING: System_Linq_Expressions overlaps _5213e1b5_46ae_4332_9d07_1553ee0d54e5_11_0
WARNING: System_Linq_Expressions overlaps _a8e271da_e0ca_4e7e_a433_ea4c99abbda3_1_0
WARNING: System_Linq_Expressions overlaps _5213e1b5_46ae_4332_9d07_1553ee0d54e5_9_0
WARNING: System_Linq_Expressions overlaps _5213e1b5_46ae_4332_9d07_1553ee0d54e5_8_0
WARNING: System_Linq_Expressions overlaps _d5550023_e8f6_4d30_9b53_c847380fc491_14_0
WARNING: System_Linq_Expressions overlaps _d5550023_e8f6_4d30_9b53_c847380fc491_13_0
WARNING: System_Linq_Expressions overlaps _d5550023_e8f6_4d30_9b53_c847380fc491_12_0
WARNING: System_Linq_Expressions overlaps _d5550023_e8f6_4d30_9b53_c847380fc491_11_0
WARNING: System_Linq_Expressions overlaps _d5550023_e8f6_4d30_9b53_c847380fc491_10_0
WARNING: System_Linq_Expressions overlaps System_IO_Compression_Native
WARNING: System_Linq_Expressions overlaps _282f1080_a9e2_418d_a67e_89db7c2c9e74_13_0
WARNING: System_Linq_Expressions overlaps _282f1080_a9e2_418d_a67e_89db7c2c9e74_12_0
WARNING: System_Linq_Expressions overlaps _282f1080_a9e2_418d_a67e_89db7c2c9e74_11_0
WARNING: System_Linq_Expressions overlaps _282f1080_a9e2_418d_a67e_89db7c2c9e74_10_0
WARNING: System_Linq_Expressions overlaps Microsoft_CodeAnalysis_Scripting_resources_7f12c71ea000
WARNING: System_Linq_Expressions overlaps Microsoft_CodeAnalysis_Scripting_resources
WARNING: System_Linq_Expressions overlaps Microsoft_CodeAnalysis_Scripting_resources_7f12c7309000
WARNING: System_Linq_Expressions overlaps Microsoft_Data_Services_Client_resources
WARNING: System_Linq_Expressions overlaps Microsoft_Data_Edm_resources
WARNING: System_Linq_Expressions overlaps Microsoft_Data_OData_resources
WARNING: System_Linq_Expressions overlaps AspNetCoreRateLimit
WARNING: System_Linq_Expressions overlaps Google_Apis
WARNING: System_Linq_Expressions overlaps Quartz
WARNING: System_Linq_Expressions overlaps Tavis_UriTemplates
WARNING: System_Linq_Expressions overlaps Microsoft_Win32_SystemEvents
WARNING: System_Linq_Expressions overlaps System_Security_Cryptography_ProtectedData
WARNING: System_Linq_Expressions overlaps AsyncEnumerable
WARNING: System_Linq_Expressions overlaps AutoMapper
WARNING: System_Linq_Expressions overlaps System_Diagnostics_TraceSource

With !sym noisy I also see a lot of these:

ELFBin: Head page of module 'X.dll' is not mapped in core.  Cannot match image without load anything option set

What I usually do afterwards for Windows .NET Core dumps is loading coreclr.dl and sos.dll (.load C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.2.8\coreclr.dll). Then, when I run e.g. !dumpheap -stat I now get the following error:

Failed to find runtime DLL (coreclr.dll), 0x80004005
Extension commands need it in order to have something to do.

I have everything together in one folder that contains:

We've created the dump like this: /usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.8/createdump -u 1

I've also tried lldb on Mac (don't have much experience here), where I get a similar error:

(lldb) clrstack
Failed to find runtime module (libcoreclr.dylib), 0x80070057
Extension commands need it in order to have something to do.
ClrStack  failed

I do have sos installed and libcoreclr.dylib is located at /usr/local/share/dotnet/shared/Microsoft.NETCore.App/2.2.8/libcoreclr.dylib. I've tried this with setclrpath, but that didn't solve it.

Any suggestions on how I should continue?

mikem8361 commented 4 years ago

SOS for Linux dumps on Windows isn't supported for 2.1. It is only supported for 3.1.7 and recent 5.0 builds (not sure if the latest preview is supported). This feature is still in a preliminary stage. There are also some windbg fixes coming that may also be necessary for this to work end-to-end.

/cc: @sdmaclea

Aaronmsv commented 4 years ago

Ah I see, I'll setup a Linux VM to analyze the dump then. Thanks!