'The given crash dump is in an incorrect format' when analyzing
Environment
- Windows Server 2019
- CPU: Intel E3-1230 v6
- RAM: 16 GB
- Dotnet SDK: 3.1.300
Steps taken
- Took dump using
dotnet-dump collect -p {processId} - Opened for analyzing using
dotnet-dump analyze {dumpName}.dmp - Ran
dumpheap -stat
Expected Output
Table showing count and size of objects in the heap.
Actual Output
Unhandled exception: Microsoft.Diagnostics.Runtime.ClrDiagnosticsException: The given crash dump is in an incorrect format.
at Microsoft.Diagnostics.Repl.CommandProcessor.Handler.Invoke(MethodInfo methodInfo, InvocationContext context) in /_/src/Microsoft.Diagnostics.Repl/Command/CommandProcessor.cs:line 297
at Microsoft.Diagnostics.Repl.CommandProcessor.Handler.System.CommandLine.Invocation.ICommandHandler.InvokeAsync(InvocationContext context) in /_/src/Microsoft.Diagnostics.Repl/Command/CommandProcessor.cs:line 256
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseErrorReporting>b__22_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseSuggestDirective>b__7_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseDirective>b__6_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseHelp>b__20_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass5_0.<<UseExceptionHandler>b__0>d.MoveNext()
What version of dotnet-dump (dotnet-dump --version) did you use? Can you attach the dump you created?
The version of dotnet-dump is 3.1.122203+2c03f4eb39cfa9fe281204b125203ff79627ca02
The dump is 24 GB, so I doubt I can share this with you. Attempting to sort a memory leak in our web-app. The dotnet.exe process was consuming ~12 GB RAM, though our server had maxed out on RAM and was using the page-file.
I don't need the dump. Since it is that large, I assume it might have > 300 modules/assemblies it and there is a bug that the Windows debugger team is looking at in the API (MiniDumpWriteDump) that dotnet-dump uses.
There is a slight chance that the --type heap option to dotnet-dump might help.
Do you believe the issue is when the dump is collected or when analyzed? I assume when collected.
The bug you mentioned suggests this only happens on Azure App Service and possibly due to virtualization. We're not using virtualization of any kind. It's a bare-metal install.
Can you suggest any workarounds. Could I perhaps take a dump instead via Task Manager?
Yes, it is on collect: dotnet-dump collect --type heap <pid>. I forgot that they narrowed down that bug to Azure App Service.
The task manager dumps or attaching with windbg and creating a dump might work better, but they all use the same Windows API which invokes a runtime module (the DAC mscoredaccore.dll) memory enumeration API. But what makes me think the problem is in the Windows side is that the default for dotnet-dump is "full" which means this DAC api shouldn't be called.
You could try opening the dump in VS. The bug could be in dotnet-dump's minidump reader.
Could you try a simpler but similar test app just to see if the basic dump collection/analyze works in your environment. If it does repo, I can use that test app to try to diagnose the problem.
We took another dump using dotnet-dump collect. This time it was 28 GB.
When trying to analyze this one with dotnet-dump analyze & dumpheap -stat, it outputs a different error message:
Failed to load data access module, 0x80131c4f
Verify that 1) you have a recent build of the debugger (10.0.18317.1001 or newer)
2) the file mscordaccore.dll that matches your version of coreclr.dll is
in the version directory or on the symbol path
3) or, if you are debugging a dump file, verify that the file
mscordaccore_<arch>_<arch>_<version>.dll is on your symbol path.
4) you are debugging on supported cross platform architecture as
the dump file. For example, an ARM dump file must be debugged
on an X86 or an ARM machine; an AMD64 dump file must be
debugged on an AMD64 machine.
You can also run the debugger command .cordll to control the debugger's
load of mscordaccore.dll.dll. .cordll -ve -u -l will do a verbose reload.
If that succeeds, the SOS command should work on retry.
If you are debugging a minidump, you need to make sure that your executable
path is pointing to coreclr.dll as well.
However, I was able to successfully open this .dmp file after I copied it to a different machine and opened with WinDbg x64, loaded SOS (from dotnet tool install -g dotnet-sos), and run !dumpheap -stat. So I believe there is also an issue with dotnet-dump analyze.
@mikem8361 could you also confirm the difference, if any, between running dotnet-dump collect -p {processId} and dotnet-dump collect -p {processId} --type Heap .
You mentioned above that the default is "full", yet "full" isn't listed on the documentation.
I'll get the docs updated on "full" dumps (it is a new type) which contain all the valid memory (code and data) in the process. "heap" contains most all of the data (heaps) but not all the code and other parts of the modules like the metadata in the managed assemblies.
If you don't mind trying a couple more things to diagnose the above error message, could you load the dump in dotnet-dump and before you run any other command execute dbgout and setsymbolserver -log. These commands turn on some logging that might help. After you run dumpheap and get that error could you run sosstatus and send all the output? Thanks.
@mikem8361 Here's the output as requested:
PS D:\Dumps> dotnet-dump analyze .\dump_20200603_141409.dmp
Loading core dump: .\dump_20200603_141409.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.
> dbgout
Debug output logging enabled
> setsymbolserver -log
Symbol download logging enabled
> dumpheap
DataTarget::ReadVirtual FAILED 80004005 address 00007FFA70460061 size 00000004
Failed to load data access module, 0x80131c4f
Verify that 1) you have a recent build of the debugger (10.0.18317.1001 or newer)
2) the file mscordaccore.dll that matches your version of coreclr.dll is
in the version directory or on the symbol path
3) or, if you are debugging a dump file, verify that the file
mscordaccore_<arch>_<arch>_<version>.dll is on your symbol path.
4) you are debugging on supported cross platform architecture as
the dump file. For example, an ARM dump file must be debugged
on an X86 or an ARM machine; an AMD64 dump file must be
debugged on an AMD64 machine.
You can also run the debugger command .cordll to control the debugger's
load of mscordaccore.dll.dll. .cordll -ve -u -l will do a verbose reload.
If that succeeds, the SOS command should work on retry.
If you are debugging a minidump, you need to make sure that your executable
path is pointing to coreclr.dll as well.
> sosstatus
Target platform: 8664 Context size 04d0
.NET Core (Windows) runtime at 00007FFA6FDA0000 size 0056c000
Runtime directory: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.4
DAC file path: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.4\mscordaccore.dll
Temp path: C:\Users\XXXXXX~1.XXX\AppData\Local\Temp\4\sos15004\
Cache: C:\Users\XXXXXXXXXX\AppData\Local\Temp\4\SymbolCache
Server: http://msdl.microsoft.com/download/symbols/
>
The issue here sounds like SOS is loading the wrong version of the DAC. Taking it to another computer forced it to download the DAC, while the local install grabbed the one it thought it had to. If you install https://github.com/dotnet/symstore/tree/master/src/dotnet-symbol and issue this command:
dotnet symbol --debugging dump_20200603_141409.dmp -o <Desired folder to cache the dlls>
then when analyzing use "setclrpath
Add issue https://github.com/dotnet/diagnostics/issues/1354 to fix the dotnet-dump ms docs.