Taking Threaddump in .Net environment using Microsoft’s Debug Diagnostic Tool

Overview:

Getting a dump or thread dump is necessary when your java application interacts with .Net client..for ex. An .Net client accessing java based services hosted in an JEE container, .Net client access Coherence Cache. I have used Microsoft’s Diagnostic Tool to resolve many performance related issues with .Net based applications.

Download and Installation:

Download the tool from Microsoft.com, http://www.microsoft.com/en-us/download/details.aspx?id=26798 link works so far. Download and install the installer to your local machine, I installed it in D:\Coherence\DebugDiag(Image 1).

DebugDiag.exe –> exe  To open the tool

log/Misc –> folder where the dump files go after capture.

Image # 1:

Start Debug Diagnostic:

We can start the tool by double clicking DebugDiag.exe. The tool has “Rules”, “Advanced Analysis” and “Process” tabs.Process list all the process running on the System, we will be using that tab mainly to capture data and Advanced Analysis will be used to analyze any existing data.

Image # 2:

Capture Dump/Dumps:

In my environment, I am running a C# application called ContactCache.Windows eventually it run an exe ContactCache.Windows.vshost.exe. If you click on the processes tab, it lists all the running process from the system and you could see the application ContactCache.Windows which is running inside C# 2010 express edition.

Image #3:

If you right click on the process which your going to debug, you will the following options(Image 4),

i) Monitor For Leaks –> This is capture memory data, which we are not discussing on this blog

ii) Create Full Userdump –> Capture one dump, which is mainly to find out dead lock situations were threads never get release.

iii) Create Mini Userdump –> As of now I couldn’t find out the difference between Full Userdump and Mini Userdump other than the file size.

iv) Create Userdump series –> This is to capture series of dumps, this helps to find out intermittent performance issues. This is the most used option based on my experience.

v) Terminate Process –> This you don’t want to perform in a production environment.

vi) Copy –> This is to copy certain information about the process.

As I mentioned before dump files will be captured into <DebugDiag_Folder>Logs/Misc folder with file name as <exe name> <PID><Data and Time> <Dump Category> ..for ex: ContactCache.Windows.vshost.exe__PID__3096__Date__10_04_2012__Time_10_09_58AM__95__Manual Dump..

Image #4:

Getting Full Userdump or Mini Userdump is easy, just choose that option DebugDiag tool capture the dump. If you want to capture series of dumps, then we need to select the options. By default (Image # 5) it capture 10 mini dumps for every 3 seconds, we might need to modify this according to your issue. If the hang happens longer period of time, you might need to increase the between time and more or less dumps.

Image # 5:

Analyze Dump/Dumps:

As I mentioned before, to analyze an existing dump we will use “Advanced Analysis” tab. Make sure Crash/Hang Analyzers is chosen from the category, by default tool chose that anyway. We can import single dump/multiple dumps using Add Data files button. Remove Data files are used to remove dump files from the list. Start Analysis button analyze the chosen file and open up the report in the IE explorer.

Image # 6:

Adding dump series by clicking Add Data Files button (Image # 7)  and click Open.

Image # 7:

Now choose one of the file and click start analysis button(Image # 8) , it will take few minutes and will open up the report in an explore(Image # 9).

Image # 8:

Image # 9:

Summary:

Understanding the report is as simple as looking into java thread dump, look for threads that not moving. This tool helps me to resolve many .Net performance issues hopefully it helps you guys as well.

About sasikumarchellappan

Part of Sustaining Weblogic Development Team of Oracle Weblogic Server.
This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to Taking Threaddump in .Net environment using Microsoft’s Debug Diagnostic Tool

  1. something happened to this post. will re post
    the same soon.

Leave a comment