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

[Request] Need a crossdac and CLRMD reader to analyze macOS dumps on Windows #2590

Closed AArnott closed 1 year ago

AArnott commented 3 years ago

I can't analyze a macOS dump taken with dotnet dump. I am using a Windows machine.

.NET runtime: 5.0.10 Dump file

dotnet dump analyze "C:\Users\andarno\Downloads\testResults-macOS\Library.Tests\TestResults\c14a3907-eae8-4fb8-9113-c3f088a43804\dotnet_4902_20210915T131732_hangdump.dmp"
Loading core dump: C:\Users\andarno\Downloads\testResults-macOS\Library.Tests\TestResults\c14a3907-eae8-4fb8-9113-c3f088a43804\dotnet_4902_20210915T131732_hangdump.dmp ...
Ready to process analysis commands. Type 'help' to list available commands or 'help [command]' to get detailed help on a command.
Type 'quit' or 'exit' to exit the session.
> clrstack
Failed to load data access module, 0x80131c64
Can not load or initialize mscordaccore.dll. The target runtime may not be initialized.

For more information see https://go.microsoft.com/fwlink/?linkid=2135652
> setsymbolserver -ms
Added Microsoft public symbol server
> clrstack
Failed to load data access module, 0x80131c64
Can not load or initialize mscordaccore.dll. The target runtime may not be initialized.

For more information see https://go.microsoft.com/fwlink/?linkid=2135652

This dump only shows native callstacks (without symbols) in windbg, and sos doesn't work there either. VS can't open the dump at all.

I also note that the mac dump is huge. The equivalent hang dump on linux is 434MB, but on macOS it's 2.2GB. That's a lot of storage for a non-analyzable dump.

Having reviewed the faq, the steps it recommends doesn't work, as you can see above. I also tried installing dotnet-sos and running dotnet-sos install but that didn't help.

tommcdon commented 3 years ago

Thanks for reporting this issue. Analyzing dumps on Windows collected on macOS is not supported. I have changed this issue to a documentation bug to track updating https://docs.microsoft.com/dotnet/core/diagnostics/dotnet-dump accordingly. Dotnet-Dump analyze should work for dumps collected on the same macOS machine. Dumps collected on Windows, macOS, and Linux can be analyzed on the same machine. Visual Studio and dotnet-dump running on Windows can both analyze Linux dumps collected with dotnet-dump (both glibc and muscl based distros of Linux).

mikem8361 commented 3 years ago

There are two major pieces of work to implement this E2E: 1) dotnet-dump work: add a MachO core dump reader to clrmd (Lee Culver is working on that). This will also allow dotnet-dump to work on MacOS for MachO core dumps generated in 6.0. 2) runtime work: a cross-OS DAC for MacOS (something we may consider for 7.0).

AArnott commented 3 years ago

@tommcdon In addition to updating the doc you linked to, can you please also update the faq that the error message links to?

tommcdon commented 3 years ago

@AArnott good idea on updating the FAQ. We will do that work as part of updating the dotnet-dump docs.

tommcdon commented 1 year ago

CLRMD now supports macOS dumps. Created the following item in the runtime repo to track the creation of the macOS cross-DAC: https://github.com/dotnet/runtime/issues/82796