Csi dot net (Hardcore .NET production debugging)

Post on 14-Jun-2015

135 views 2 download

Tags:

description

Presentation for Dotned usergroup about hardcore .NET production debugging.

transcript

Kennis.Mensen.Oplossingen.

CSI.NETHardcore .NET debugging

13-04-2023

Scenario’s

• Crash• Hang• Memory leak• High CPU Hang

13-04-2023

Hang

• Symptoms– 503 “Service unavailable”– High execution times

• Diagnose– Check performance counters

» Request execution time / Requests queued » CPU

– Create dump» What are the threads doing?

13-04-2023

Memory leak

• Symptoms– Increase of memory and doesn’t go down– OutOfMemory exceptions

• Diagnose– Is it a native or managed leak?

» Private bytes» Bytes in all heaps

– If managed where does the data go?» Check heap sizes (Performance counters)» Create dump and investigate heap

13-04-2023

Generational garbage collectionJeffrey Richter, CLR via C#, 4th editionSource:

Large Object Heap Fragmentation

https://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-object-heap/Source:

13-04-2023

High CPU hang

• Symptoms– Process is using up all CPU and doesn’t go down

• Diagnose– Is it caused by garbage collection?

» %time in GC» Allocated bytes / sec» Number of collections per GC generation

– Create dump and see what threads are doing

13-04-2023

Prevent SOS version errors

• Copy sos.dll & mscordacwks.dll from correct framework folder0:037> !clrstackThe 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.1SOS Version: 4.0.30319.235CLRDLL: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\mscordacwks.dll:4.0.30319.235 f:8 doesn't match desired version 4.0.30319.01 f:8CLRDLL: Loaded DLL c:\temp\symbols\mscordacwks_x86_x86_4.0.30319.01.dll\4BA1D9EF66f000\mscordacwks_x86_x86_4.0.30319.01.dllOS Thread Id: 0x690 (37)Unable to walk the managed stack. The current thread is likely not a managed thread.You can run !threads to get a list of managed threads in the process 

13-04-2023

Debugger Markup Language

.prefer_dml 1

13-04-2023

Closing

• The answer is in the dump..• Sometimes there is no other way• Just “take a dump” and poke around• Bing Google is your friend

13-04-2023

Links

• Tess Ferrandez (Debugging blog)http://blogs.msdn.com/b/tess/

• Windows 8.1 SDK (Debugging Tools)http://msdn.microsoft.com/en-US/windows/desktop/bg162891

• Sysinternals Suitehttp://technet.microsoft.com/en-us/sysinternals/bb842062.aspx

• SOSEXhttp://www.stevestechspot.com/SOSEXV40NowAvailable.aspx

13-04-2023

13-04-2023

13-04-2023

Aviva Solutions

www.avivasolutions.nl

Vragen

@jonnekats

Jonne.kats@avivasolutions.nl