Archive | Windbg RSS for this section

Windbg dump framework 4 and framework 2 dlls loaded

I took a dump from a SharePoint 2010 w3wp process, to analyze several exceptions, in my local machine.

The server had the .Net framework 2.0 and .Net framework 4.0 installed.

The SharePoint 2010 AppPool was configured to run in .net 2.0 (you can validate that in IIS admin console).

I copied the server dlls (mscorwks.dll, mscordacwks.dll and sos.dll) from .net framework 2.0 – 64 bits folder, from server, to my local disk (G:\Microsoft\temp\2.0\).

I run windbg (64 bits version), open my crash dump, and loaded the dlls.

0:000> !load G:\Microsoft\temp\2.0\sos.dll
0:000> !load G:\Microsoft\temp\2.0\mscorwks.dll
0:000> !load G:\Microsoft\temp\2.0\mscordacwks.dll

Then I started with the debugging, but when run the “DumpHeap -stat” command I had an error:

0:000> !DumpHeap -stat
The version of SOS does not match the version of CLR you are debugging.  Please
load the matching version of SOS for the version of CLR you are debugging.
CLR Version: 4.0.30319.1
SOS Version: 2.0.50727.4216
Error requesting details

To solve this:

  1. Renamed  and copied my mscordacwks.dll to symbols path (at bold you can see the Dlls version). c:\symbols\mscordacwks_AMD64_AMD64_2.0.50727.4216.dll\4E1545829a3000\mscordacwks_AMD64_AMD64_2.0.50727.4216.dll)
  2. run  .cordll -I mscorwks.dll -N -ve
  3. loaded the psscor2.dll 64 bits (http://www.microsoft.com/en-us/download/details.aspx?id=1073)

My debugging session:

0:000> !load G:\Microsoft\temp\2.0\sos.dll
0:000> !load G:\Microsoft\temp\2.0\mscorwks.dll
0:000> !load G:\Microsoft\temp\2.0\mscordacwks.dll
0:000> .cordll -I mscorwks.dll -N -ve
NOTE: This code is not supported and may not work.
Do not report any problems you have.
CLR DLL status: Loaded DLL c:\symbols\mscorwks.dll\4E1545829a3000\mscordacwks_AMD64_AMD64_2.0.50727.4216.dll
Test new CLR interfaces
0:000>  .cordll -I mscorwks.dll -N -ve
CLRDLL: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscordacwks.dll:2.0.50727.6400 f:0
doesn’t match desired version 2.0.50727.4216 f:0
CLRDLL: Unable to find mscordacwks_AMD64_AMD64_2.0.50727.4216.dll by mscorwks search
CLRDLL: Unable to find ‘mscordacwks_AMD64_AMD64_2.0.50727.4216.dll’ on the path
CLRDLL: Loaded DLL c:\symbols\mscorwks.dll\4E1545829a3000\mscordacwks_AMD64_AMD64_2.0.50727.4216.dll
NOTE: This code is not supported and may not work.
Do not report any problems you have.
CLR DLL status: Loaded DLL c:\symbols\mscorwks.dll\4E1545829a3000\mscordacwks_AMD64_AMD64_2.0.50727.4216.dll
Test new CLR interfaces
0:000> !DumpHeap -stat
Error requesting details
Unable to build snapshot of the garbage collector state
0:000> !DumpHeap -stat
The version of SOS does not match the version of CLR you are debugging.  Please
load the matching version of SOS for the version of CLR you are debugging.
CLR Version: 4.0.30319.1
SOS Version: 2.0.50727.4216
Error requesting details
Unable to build snapshot of the garbage collector state
0:000> !load G:\Microsoft\Debug\psscor2\psscor2\amd64\psscor2.dll
0:000> !DumpHeap -stat
Using our cache to search the heap.
0x000007ff01bc0f50          1            24 <Unloaded Type>
0x000007ff01ab72a0          1            24 System.Collections.Generic.ObjectEqualityComparer`1[[System.Data.ProviderBase.DbConnectionPoolGroup, System.Data]]
0x000007ff01ab71b0          1            24 System.Collections.Generic.ObjectEqualityComparer`1[[System.Data.ProviderBase.DbConnectionPool, System.Data]]
0x000007ff01ab6e28          1            24 System.Collections.Generic.ObjectEqualityComparer`1[[System.Data.Index, System.Data]]
0x000007ff01ab6d38          1            24 System.Collections.Generic.ObjectEqualityComparer`1[[System.Data.ProviderBase.DbConnectionInternal, System.Data]]

Windbg dump with framework 4.0 dlls and framework 2.0 dlls

When I tried to analyze a w3wp Sharepoint 2010 process dump, from a server where I had the 2.0 and 4.0 frameworks installed I had problems running “DumpHeap -stat”:

0:000> !DumpHeap -stat
The garbage collector data structures are not in a valid state for traversal.
It is either in the “plan phase,” where objects are being moved around, or
we are at the initialization or shutdown of the gc heap. Commands related to
displaying, finding or traversing objects as well as gc heap segments may not
work properly. !dumpheap and !verifyheap may incorrectly complain of heap
consistency errors.
Error requesting GC Heap data

Since my process was running in framework 2.0, I copied the Dlls from server, from .net framework 2.0 64 bits folder:

sos.dll

mscorwks.dll

mscordacwks.dll

load this dlls, and run:

0:000>  .cordll -I mscorwks.dll -N -ve

CLRDLL: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscordacwks.dll:2.0.50727.6400 f:0
doesn’t match desired version 2.0.50727.4216 f:0
SYMSRV:  c:\symbols\mscordacwks_AMD64_AMD64_2.0.50727.4216.dll\4E1545829a3000\mscordacwks_AMD64_AMD64_2.0.50727.4216.dll not found
SYMSRV:  http://msdl.microsoft.com/download/symbols/mscordacwks_AMD64_AMD64_2.0.50727.4216.dll/4E1545829a3000/mscordacwks_AMD64_AMD64_2.0.50727.4216.dll not found
CLRDLL: Unable to find mscordacwks_AMD64_AMD64_2.0.50727.4216.dll by mscorwks search
CLRDLL: Unable to find ‘mscordacwks_AMD64_AMD64_2.0.50727.4216.dll’ on the path
DBGHELP: c:\symbols\mscorwks.dll\4E1545829a3000\mscorwks.dll – OK
CLRDLL: Unable to get version info for ‘c:\symbols\mscorwks.dll\4E1545829a3000\mscordacwks_AMD64_AMD64_2.0.50727.4216.dll’, Win32 error 0n87
CLRDLL: ERROR: Unable to load DLL mscordacwks_AMD64_AMD64_2.0.50727.4216.dll, Win32 error 0n87
NOTE: This code is not supported and may not work.
Do not report any problems you have.
CLR DLL status: ERROR: Unable to load DLL mscordacwks_AMD64_AMD64_2.0.50727.4216.dll, Win32 error 0n87
Test new CLR interfaces

After that I renamed my mscordacwks dll to mscordacwks_AMD64_AMD64_2.0.50727.4216.dll, copied it to symbols directory  (c:\symbols\mscorwks.dll\4E1545829a3000\) and run:

0:000>  .cordll -I mscorwks.dll -N -ve

After that I could run my debugging commands.

Windbg – analyze a framework 4.0 exception Dump

Open windbg, if the dump is from a 64 bits plataforma use windbg 64 bits.

Go to windbg menu File/Open Crash Dump, and choose your dump file.

Load the clr.dll, this should be in the same version that it is in the plataform, from where you took your dump.

!load C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll

Load the psscor4.dll, you can download this dll from (http://www.microsoft.com/en-us/download/details.aspx?id=21255), be sure of the version 64 vs x86:

!load G:\Psscor4\Psscor4\amd64\amd64\psscor4.dll

Now you can access the Stack of your exception, using (!ClrStack), this command can have other parameters, if you use (!ClrStack -a), you can see the parameters in each call.

To print the value of any of those parameters, you can use (!do <parameter adress>)

0:008> !ClrStack

OS Thread Id: 0x2a8 (8) Child SP         IP               Call Site 0000000001e9a978 000007fefda8a49d [HelperMethodFrame_PROTECTOBJ: 0000000001e9a978] System.Reflection.RuntimeAssembly._nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, Boolean, Boolean, Boolean) 0000000001e9ab50 000007fef5bd0117 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(System.Reflection.AssemblyName, System.Security.Policy.Evidence, System.Threading.StackCrawlMark ByRef, Boolean, Boolean)*** WARNING: Unable to verify checksum for mscorlib.ni.dll

0000000001e9abf0 000007fef5bb44f0 System.Reflection.RuntimeAssembly.InternalLoadFrom(System.String, System.Security.Policy.Evidence, Byte[], System.Configuration.Assemblies.AssemblyHashAlgorithm, Boolean, Boolean, System.Threading.StackCrawlMark ByRef) 0000000001e9ac50 000007fef5bb729d System.Reflection.Assembly.LoadFrom(System.String) 0000000001e9acb0 000007ff0020079a WebActivator.ActivationManager.get_Assemblies()*** WARNING: Unable to verify checksum for WebActivator.dll *** ERROR: Module load completed but symbols could not be loaded for WebActivator.dll

0000000001e9ad80 000007ff00200278 WebActivator.ActivationManager.RunActivationMethods[[System.__Canon, mscorlib]]() 0000000001e9ae90 000007ff00200206 WebActivator.ActivationManager.RunPreStartMethods() 0000000001e9aec0 000007ff00200158 WebActivator.ActivationManager.Run() 0000000001e9b598 000007fef6c210b4 [DebuggerU2MCatchHandlerFrame: 0000000001e9b598] 0000000001e9b680 000007fef6c210b4 [CustomGCFrame: 0000000001e9b680] 0000000001e9b648 000007fef6c210b4 [GCFrame: 0000000001e9b648] 0000000001e9b5d8 000007fef6c210b4 [GCFrame: 0000000001e9b5d8] 0000000001e9b9a8 000007fef6c210b4 [HelperMethodFrame_PROTECTOBJ: 0000000001e9b9a8] System.RuntimeMethodHandle._InvokeMethodFast(System.IRuntimeMethodInfo, System.Object, System.Object[], System.SignatureStruct ByRef, System.Reflection.MethodAttributes, System.RuntimeType) 0000000001e9baf0 000007fef5bc5cb8 System.RuntimeMethodHandle.InvokeMethodFast(System.IRuntimeMethodInfo, System.Object, System.Object[], System.Signature, System.Reflection.MethodAttributes, System.RuntimeType) 0000000001e9bbe0 000007fef5bc5789 System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, Boolean) 0000000001e9bd20 000007fef5c10426 System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo) 0000000001e9bd70 000007fee2c4fe77 System.Web.Compilation.BuildManager.InvokePreStartInitMethods(System.Collections.Generic.ICollection`1<System.Reflection.MethodInfo>)*** WARNING: Unable to verify checksum for System.Web.ni.dll

0000000001e9be30 000007fee2c4f9e1 System.Web.Compilation.BuildManager.CallPreStartInitMethods() 0000000001e9bea0 000007fee2c4210f System.Web.Hosting.HostingEnvironment.Initialize(System.Web.Hosting.ApplicationManager, System.Web.Hosting.IApplicationHost, System.Web.Configuration.IConfigMapPathFactory, System.Web.Hosting.HostingEnvironmentParameters, System.Security.Policy.PolicyLevel, System.Exception) 0000000001e9bf20 000007fee2c41cc6 System.Web.Hosting.HostingEnvironment.Initialize(System.Web.Hosting.ApplicationManager, System.Web.Hosting.IApplicationHost, System.Web.Configuration.IConfigMapPathFactory, System.Web.Hosting.HostingEnvironmentParameters, System.Security.Policy.PolicyLevel) 0000000001e9c398 000007fef6c210b4 [GCFrame: 0000000001e9c398] 0000000001e9c3d0 000007fef6c210b4 [GCFrame: 0000000001e9c3d0] 0000000001e9c608 000007fef6c210b4 [ContextTransitionFrame: 0000000001e9c608] 0000000001e9c8a0 000007fef6c210b4 [GCFrame: 0000000001e9c8a0] 0000000001e9c8d8 000007fef6c210b4 [GCFrame: 0000000001e9c8d8] 0000000001e9e1f8 000007fef6c210b4 [CustomGCFrame: 0000000001e9e1f8] 0000000001e9e220 000007fef6c210b4 [CustomGCFrame: 0000000001e9e220] 0000000001e9e248 000007fef6c210b4 [CustomGCFrame: 0000000001e9e248] 0000000001e9e270 000007fef6c210b4 [CustomGCFrame: 0000000001e9e270] 0000000001e9e298 000007fef6c210b4 [CustomGCFrame: 0000000001e9e298] 0000000001e9e2c0 000007fef6c210b4 [CustomGCFrame: 0000000001e9e2c0] 0000000001e9e2e8 000007fef6c210b4 [CustomGCFrame: 0000000001e9e2e8] 0000000001e9e8e8 000007fef6c210b4 [TPMethodFrame: 0000000001e9e8e8] System.Web.Hosting.HostingEnvironment.Initialize(System.Web.Hosting.ApplicationManager, System.Web.Hosting.IApplicationHost, System.Web.Configuration.IConfigMapPathFactory, System.Web.Hosting.HostingEnvironmentParameters, System.Security.Policy.PolicyLevel) 0000000001e9e950 000007fee2c40b54 System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(System.String, System.Web.Hosting.IApplicationHost, System.Web.Hosting.HostingEnvironmentParameters) 0000000001e9eb60 000007fee2c3faa5 System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(System.String, System.Web.Hosting.IApplicationHost, System.Web.Hosting.HostingEnvironmentParameters) 0000000001e9ebc0 000007fee2c3fa22 System.Web.Hosting.ApplicationManager.GetAppDomainWithHostingEnvironment(System.String, System.Web.Hosting.IApplicationHost, System.Web.Hosting.HostingEnvironmentParameters) 0000000001e9ec30 000007fee2c3f938 System.Web.Hosting.ApplicationManager.CreateObjectInternal(System.String, System.Type, System.Web.Hosting.IApplicationHost, Boolean, System.Web.Hosting.HostingEnvironmentParameters) 0000000001e9ec90 000007fee33a592a System.Web.Hosting.ProcessHost.StartApplication(System.String, System.String, System.Object ByRef) 0000000001e9ed40 000007fee33f2972 DomainNeutralILStubClass.IL_STUB_COMtoCLR(IntPtr, IntPtr, IntPtr ByRef) 0000000001e9f138 000007fef6c8e93e [GCFrame: 0000000001e9f138] 0000000001e9f320 000007fef6c8e93e [ComMethodFrame: 0000000001e9f320]