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.
2. Check dotnet process id. In example below, process id of the web app is 29.
ps aux | grep dotnet
3. Change directory to persistent storage.
4. Capture dotnet core dump.
dotnet-dump collect -p [process-id] --type Full --diag
Specifies the process ID number to collect a dump from.
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.
Enables dump collection diagnostic logging.
5. Once capture completed, we should be able to see dump file in the "/home/LogFiles" directory.
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.