csi dot net (hardcore .net production debugging)
DESCRIPTION
Presentation for Dotned usergroup about hardcore .NET production debugging.TRANSCRIPT
![Page 1: Csi dot net (Hardcore .NET production debugging)](https://reader036.vdocuments.mx/reader036/viewer/2022081420/557d811dd8b42a58788b4d39/html5/thumbnails/1.jpg)
Kennis.Mensen.Oplossingen.
CSI.NETHardcore .NET debugging
![Page 2: Csi dot net (Hardcore .NET production debugging)](https://reader036.vdocuments.mx/reader036/viewer/2022081420/557d811dd8b42a58788b4d39/html5/thumbnails/2.jpg)
13-04-2023
Scenario’s
• Crash• Hang• Memory leak• High CPU Hang
![Page 3: Csi dot net (Hardcore .NET production debugging)](https://reader036.vdocuments.mx/reader036/viewer/2022081420/557d811dd8b42a58788b4d39/html5/thumbnails/3.jpg)
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?
![Page 4: Csi dot net (Hardcore .NET production debugging)](https://reader036.vdocuments.mx/reader036/viewer/2022081420/557d811dd8b42a58788b4d39/html5/thumbnails/4.jpg)
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
![Page 5: Csi dot net (Hardcore .NET production debugging)](https://reader036.vdocuments.mx/reader036/viewer/2022081420/557d811dd8b42a58788b4d39/html5/thumbnails/5.jpg)
13-04-2023
Generational garbage collectionJeffrey Richter, CLR via C#, 4th editionSource:
![Page 6: Csi dot net (Hardcore .NET production debugging)](https://reader036.vdocuments.mx/reader036/viewer/2022081420/557d811dd8b42a58788b4d39/html5/thumbnails/6.jpg)
Large Object Heap Fragmentation
https://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-object-heap/Source:
![Page 7: Csi dot net (Hardcore .NET production debugging)](https://reader036.vdocuments.mx/reader036/viewer/2022081420/557d811dd8b42a58788b4d39/html5/thumbnails/7.jpg)
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
![Page 8: Csi dot net (Hardcore .NET production debugging)](https://reader036.vdocuments.mx/reader036/viewer/2022081420/557d811dd8b42a58788b4d39/html5/thumbnails/8.jpg)
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
![Page 9: Csi dot net (Hardcore .NET production debugging)](https://reader036.vdocuments.mx/reader036/viewer/2022081420/557d811dd8b42a58788b4d39/html5/thumbnails/9.jpg)
13-04-2023
Debugger Markup Language
.prefer_dml 1
![Page 10: Csi dot net (Hardcore .NET production debugging)](https://reader036.vdocuments.mx/reader036/viewer/2022081420/557d811dd8b42a58788b4d39/html5/thumbnails/10.jpg)
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
![Page 11: Csi dot net (Hardcore .NET production debugging)](https://reader036.vdocuments.mx/reader036/viewer/2022081420/557d811dd8b42a58788b4d39/html5/thumbnails/11.jpg)
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
![Page 12: Csi dot net (Hardcore .NET production debugging)](https://reader036.vdocuments.mx/reader036/viewer/2022081420/557d811dd8b42a58788b4d39/html5/thumbnails/12.jpg)
13-04-2023
![Page 13: Csi dot net (Hardcore .NET production debugging)](https://reader036.vdocuments.mx/reader036/viewer/2022081420/557d811dd8b42a58788b4d39/html5/thumbnails/13.jpg)
13-04-2023