How to collect dotnet core app dumps from Linux and analyze dumps on Linux

You will need a Linux VM to analyze dumps from Linux, so the instructions below included how to create an Linux VM in Azure and how to RDP to it.



1. Create a Linux VM via Azure Portal, for example, using Linux ubuntu 18.04. Setup a user and password for later use.

2. Download Putty from https://www.ssh.com/ssh/putty/download

3. Connect to the Linux VM using Putty (instructions see https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ssh-from-windows)

4. Follow instructions on https://docs.microsoft.com/en-us/azure/virtual-machines/linux/use-remote-desktop to install xfce and enable xrdp

5. Open port for RDP via command below:

az vm open-port --resource-group LinuxTestJasonXu --name LinuxJasonXu --port 3389

where LinuxTestJasonXu needs to be replaced with your resource group name and LinuxJasonXu needs to be replaced with your Linux VM name.

6. Download RDP file from Azure Portal

7. Connect to the Linux VM using RDP client with user name and password set at step 1.

8. Install dotnet core from https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-manager-ubuntu-1904

9. Install dotnet-dump tool from https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-dump

10. Collect dump using the following command:

dotnet-dump collect -p 14256 --type heap

where 14256 is the PID that needs to be replaced with the desired PID.

Further options of dump collection command see reference at https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-dump

11. Analyze dump using dotnet-dump analyze, further instructions see docs below:

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

https://github.com/dotnet/diagnostics/blob/master/documentation/dotnet-dump-instructions.md



For example:



jasonxucss@LinuxJasonXu:~$ dotnet-dump analyze /home/jasonxucss/cases/Dumps/HighMem.dmp

Loading core dump: /home/jasonxucss/cases/Dumps/HighMem.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.

> dumpheap -stat



Explore the available debug commands by enter help at the prompt.

Continue reading...
 
Top Bottom