How does is work.

The application goes in with a managed debugger (mdbg – linked in so nothing has to be installed). The debugger stops the application and generates a list of all CLR stacks running for the process. The application is started again. This operation is a quick operation and can be executed on a running production server with unchanged production code.

Issues

Stackdump can not connect to w3wp processes that are using NetworkService as Application Pool Identity

Installation

Uncompress the binaries to some folder on the same computer you are planning to use stackdump on (it’s possible to just copy one executable to the production environment).
The following executables are in the compressed file:
Net4/X86/Stackdump.exe (for .Net 4.0 32-bit architecture)
Net4/X64/Stackdump.exe (for .Net 4.0 64-bit architecture)
Net2/X86/Stackdump.exe (To use when .Net 4.0 is not installed and supports .Net 2.0-3.5, 32-bit architecture)
Net2/X64/Stackdump.exe (To use when .Net 4.0 is not installed and supports .Net 2.0-3.5, 64-bit architecture)

Usage:

Find out the process identity using Windows Task Manager or similar (it can be done by stackdump.exe itself if you are debugging .Net 4 assemblies).
Open a command window as an administrator.
Execute stackdump.exe for the correct architecture you are going to debug with process identity as the argument.
<framework version>\<architecture 32 or 64-bit>\Stackdump.exe <process id>

Example

To take out all threads stacks on a 64-bit environment running .Net 4 for a process with identity 1024
C:\Programs\stackdump\Net4\X64\Stackdump.exe 1024

Output for a ASP.NET web server

OS Thread Id:2908
OS Thread Id:6100
OS Thread Id:6088
OS Thread Id:168
OS Thread Id:4564
EPiServer.XForms.WebControls.Select1.RenderRadioButtons(N/AEPiServer.WebControls.ControlAdapters.RewriteFormHtmlTextWriter)
System.Web.UI.Control.RenderChildrenInternal(N/AN/AN/A)
System.Web.UI.Control.RenderChildrenInternal(N/AN/AN/A)
System.Web.UI.WebControls.WebControl.RenderContents(N/AN/A)
System.Web.UI.WebControls.WebControl.Render(N/AN/A)
System.Web.UI.Control.RenderChildrenInternal(N/AN/AN/A)
System.Web.UI.Control.RenderChildrenInternal(N/AN/AN/A)
System.Web.UI.Control.RenderChildrenInternal(N/AN/AN/A)
System.Web.UI.Control.RenderChildrenInternal(N/AN/AN/A)
System.Web.UI.Control.RenderChildrenInternal(N/AN/AN/A)
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(N/AN/A)
System.Web.UI.HtmlControls.HtmlForm.Render(N/AN/A)
EPiServer.WebControls.ControlAdapters.HtmlFormAdapter.Render(N/AN/A)
System.Web.UI.Control.RenderControlInternal(N/AN/AN/A)
System.Web.UI.HtmlControls.HtmlForm.RenderControl(N/AN/A)
ASP.templatespublicmasterpagesmasterpagemaster.RenderHtmlElement(ASP.templatespublicmasterpagesmasterpagemasterSystem.Web.UI.Html32TextWriterSystem.Web.UI.HtmlControls.HtmlGenericControl)
System.Web.UI.Control.RenderChildrenInternal(N/AN/AN/A)
System.Web.UI.HtmlControls.HtmlContainerControl.Render(N/AN/A)
System.Web.UI.Control.RenderChildrenInternal(N/AN/AN/A)
System.Web.UI.Control.RenderChildrenInternal(N/AN/AN/A)
System.Web.UI.Page.Render(N/AN/A)
System.Web.UI.Page.ProcessRequestMain(ASP.templatespublicpagesdemoaspxSystem.BooleanSystem.Boolean)
System.Web.UI.Page.ProcessRequest(ASP.templatespublicpagesdemoaspxN/ASystem.Boolean)
System.Web.UI.Page.ProcessRequest(ASP.templatespublicpagesdemoaspx)
System.Web.UI.Page.ProcessRequest(N/AN/A)
ASP.templatespublicpagesdemoaspx.ProcessRequest(ASP.templatespublicpagesdemoaspxSystem.Web.HttpContext)
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute(N/A)
System.Web.HttpApplication.ExecuteStep(ASP.global_asaxSystem.Web.HttpApplication.CallHandlerExecutionStepSystem.Boolean&)
System.Web.HttpApplication.PipelineStepManager.ResumeSteps(System.Web.HttpApplication.PipelineStepManagerN/A)
System.Web.HttpApplication.BeginProcessRequestNotification(N/AN/AN/A)
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.HttpRuntimeSystem.Web.Hosting.IIS7WorkerRequestSystem.Web.HttpContext)
System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(N/ASystem.IntPtrN/AN/A)
System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(N/AN/AN/AN/A)
System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(N/AN/AN/AN/A)
System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(N/AN/AN/AN/A)
OS Thread Id:3576
OS Thread Id:5996
OS Thread Id:3644
OS Thread Id:3332

Last edited Nov 28, 2012 at 6:44 AM by MattiasLovstrom, version 11

Comments

No comments yet.