Thursday, December 1, 2011

Install and Configure Debug Diagnostic Tool

Microsoft's Debug Diagnostic Tool can be run to collect memory dumps of a process when it is crashing. Recently I used it to identify a crash in IIS, w3wp.exe, caused by an unhandled exception in ASP.NET serialization. Using the debug tool I was able to get more debugging information on the specific reason for the failure.

Starting with Windows Vista (including Windows 7, 2008, etc.) a feature called Windows Error reporting is enabled by default and takes dumps of all application crashes. You can use this feature first and if it doesn't report any crashes you can use Debug Diagnostic Tool. In my case Windows Error reporting wasn't catching anything.

To download the Debug Diagnostic 1.2 tool go to Before you install the .msi make sure you remove all previous versions.

To Configure Debug Diagnostic:

  1. If the crashing process is w3wp.exe, disable Health Monitoring with the following steps (you can avoid the below steps if you don’t want to disable the health monitoring but with Health Monitoring ON, we may get some false positives and issue may happen at a later time)
    1. Open IIS Manager and expand Application Pools
    2. Right-click the Application Pool and choose Recycling.
    3. Under the Edit Application Pool Recycling settings, uncheck all the recycling settings and click Next and then click on Finish.
    4. Right click the application pool and click on Advanced Settings.
    5. Under the Process Model section change the Ping Enabled to false and configure Idle Time-out (minutes) to 0
    6. Under the Rapid-Fail Protection section, change Enabled to False
    7. Click OK
    8. Recycle the application pool for these settings to take effect
  2. Create a Crash Rule in Debug Diagnostic 1.2 with the following steps:
    1. Open DebugDiag (Start -> Programs -> Debug Diagnostic Tool 1.2)
    2. Select "Crash" and click Next
    3. If the crashing process is w3wp.exe then choose the option  A specific IIS application pool and click Next and choose the application pool that is crashing from the list and click Next. (Note: The Application pool list may be empty if the IIS 6 Metabase Compatibility is not installed. In such a case you can always type the name of the application pool and click Next)
    4. If the crashing process is not w3wp.exe then choose the option A specific process and click Next and choose the process name from the list and click Next.
    5. Click Next in Advanced Configuration (Optional), click on Breakpoints and then click on Add Breakpoint
    6. Choose NTDLL!ZwTerminateProcess from the list and change the Action Type to Full User Dump and Action Limit to 5 and click on Ok. Once you hit OK, the window should look like this.
    7. Click on Save and Close 
    8. Click Next for "Rule Name". The "Userdump Location" can be changed here. 
    9. Select "Activate the rule now" and click Finish
  3. Notice the Status is Active. The Userdump Count will increase each time a dump file is created.
  4. Wait for the issue to happen...
Good luck!

1 comment:

Amma Rany said...

Its really a nice post, the content of this blog is really awesome and extraordinary.