How to collect .NET Core dump on Linux Web App
Published Apr 08 2021 04:12 AM 8,818 Views
Microsoft

While many blogs talk about capturing memory dump for .NET application on Windows platform, this blog introduces one way of collecting .NET Core dump on Linux Web App with dotnet-dump tool.

 

1. SSH to web app.

 

YangYu_5-1617879132510.png

 

2. Check dotnet process id. In example below, process id of the web app is 29.

 

ps aux | grep dotnet

 

YangYu_4-1617879037505.png

 

3. Change directory to persistent storage.

 

cd /home/LogFiles

 

4. Capture dotnet core dump.

 

dotnet-dump collect  -p [process-id]  --type Full  --diag

 

-p|--process-id <PID>

Specifies the process ID number to collect a dump from.

 

--type <Full|Heap|Mini>

Specifies the dump type, which determines the kinds of information that are collected from the process. There are three types:

Full - The largest dump containing all memory including the module images.

Heap - A large and relatively comprehensive dump containing module lists, thread lists, all stacks, exception information, handle information, and all memory except for mapped images.

Mini - A small dump containing module lists, thread lists, exception information, and all stacks.

 

--diag

Enables dump collection diagnostic logging.

 

5. Once capture completed, we should be able to see dump file in the "/home/LogFiles" directory.

 

YangYu_3-1617878880289.png

 

Limitations:

Unlike capturing memory dump on Windows Web App with procdump, dotnet-dump tool offers manual dump capture only by the time of writing. In other words, we cannot configure conditional capture to automatically collect memory dump based on cpu threshold, memory threshold or occurrence of exceptions, like we usually do on Windows Web App. Manual capture is needed in those scenarios.

 

References:

https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-dump

 

Co-Authors
Version history
Last update:
‎Jul 20 2021 08:31 AM
Updated by: