I recently designed a CLI to help folks complete the deployment of DasBlog Core using SSH on Linux. In all honesty I am Linux noob and I was blissfully was unaware of the options for editing a file, for example you can, apparently, simply open and edit the config files by using the following:

nano filename.txt

I took the opportunity to update a fair bit of documentation to help folks who are looking to install DasBlog Core on Azure App Services for Linux and Azure App Services for Windows. In doing so I found an interesting bug in the CLI and wanted to capture a memory dump and start to resolve it locally. When I execute the problematic command I want to capture the details of the crash, download it and analyze it with Visual Studio. (Yep, you can analyze managed Linux core dumps with Visual Studio now!)

I know this capture scenario would be straightforward with something like ProcDump on Windows (and yes it has a Linux version) but I wanted to avoid deploying any additional dependencies to my PaaS containers.

There is a fairly straightforward way to collect manage crash dumps on Linux, it involved updating a few environment variables. The first one is COMPlus_DbgEnableMiniDump and it is set to “0” by default and so needs to be explicitly updated as follows.:

COMPlus_DbgEnableMiniDump 1

Secondly we want to update the type of dump you collect such that you get meaningful managed information, I have had the best luck with using “3” (Limited stack traces for all existing threads in a process. Limited GC heap memory and information) or “4” (Raw memory data is included at the end, note this can produce large files).

COMPlus_DbgMiniDumpType 4

The default value of COMPlus_DbgMiniDumpType is “2” which I have found may or may not get you all the information you need to analyze the problem you are focusing on. When you get this all setup this is what the output looks like:

linux-core-dump

Please note the default location for the Linux core dumps is the /tmp folder. You can find more details on the environment variables here, which includes how you can update the output directory.


Share on Twitter Facebook

Comment Section

Comments are closed.