Silverlight and ASP.NET Production Debugging Presentation

3,780 views

Published on

Silverlight and ASP.NET Production Debugging Presentation at Portland Code Camp 2009

Published in: Technology
  • Be the first to comment

Silverlight and ASP.NET Production Debugging Presentation

  1. 1. SoftSource Consulting Portland Code Camp - 2009
  2. 2. Production Debugging of ASP.NET and Silverlight Prashant Sinha Software Architect SoftSource Consulting Portland, OR Contact me – prashant@debuggingblog.com
  3. 3. Introduction • Debugging Challenges in Production Environment • Debugging Tools in Production Environment • How to use them? • Demos
  4. 4. DEMO We will be using demo from http://debuggingblog.com/demos
  5. 5. Common Production Issues • Crash • Worker Process Recycle • Hang • Slow Response • High CPU Usage • High Memory Usage • Exceptions – Unknown • I have no clue, what’s going on • I can’t even reproduce it on my machine
  6. 6. Tools for Production Debugging • WinDbg • DebugDiag • Performance Monitor • PAL – Performance Analysis of Logs • WinDbg Extension – sos.dll and sos2.dll • Sysinternals from http://technet.microsoft.com/en- us/sysinternals/default.aspx for example Process Explorer, Process Monitor
  7. 7. WinDbg/CDB - ADPlus in Action • Memory dumps • ADPlus Usage • ADPlus Modes of Operation • ADPlus configuration file
  8. 8. Demo - ADPlus
  9. 9. Demo - WinDbg
  10. 10. Tip • Execute “windbg –IAS” to associate .dmp file with WinDbg • Execute “windbg –IS” to make windbg system default’s post mortem debugger • Execute “.prefer_dml 1” to set dml output by default, great support in CoreCLR!SOS
  11. 11. Worker Process Recycle • logEventOnRecycle attribute • Memory Based Recycling • Memory Threshold • Overlapped Recycling and their problems • Rapid Fail Protection • Process Orphaning • Periodic Recycle
  12. 12. Worker Process Recycle in Action
  13. 13. ASP.NET Worker Process - Crash Unhandled Exception System.OutOfMemoryException System.StackOverflowException System.ExecutionEngineException Heap Corruption
  14. 14. Shaun McAravey • My Boss • Teaching Windows Internals back in the days • President and CTO of SoftSource Consulting • MVP/Regional Director – Microsoft, back in the days • His Nerdness • More on him at http://www.sftsrc.com/SoftSource_People.aspx • Shares his expertise on Windows Structured Exception Handling(SEH) internals
  15. 15. SEH – Exception Flow Chart
  16. 16. SEH – Termination Flow Chart
  17. 17. Demo – Crash/Unhandled Exception How to determine root cause in production environment?
  18. 18. Analyze First Chance Exception • Event Log • Logs • ADPlus Configuration file and Pseudo Register • Collect Memory Dump on conditional exception • Analyze Dump using WinDbg
  19. 19. Demo - First Chance Exception Unexpected Behavior on First Chance Exception and the root cause analysis in production environment?
  20. 20. Performance/Hang • Long Running Requests • Thread Starvation • Context Switching • Deadlock/WaitHandle • Low CPU hang – lock/external resources/database/web services • High CPU Hang – Heavy load on Server/Infinite loop/Too Much GC/Native Thread spinning on Lock
  21. 21. Analyze Performance Issues in Production • Identify the Server/Process • Use Performance Counter logs • Memory Dump of a Process • Thread Stacks • CPU Usage Stats • Memory Statistics • Managed Heap statistics • ThreadPool Stats
  22. 22. Demo - PAL PAL – Performance Analysis of Logs http://www.codeplex.com/PAL
  23. 23. High Memory Usage(OOM Exception) • Managed Heap – JIT Code Heap – GC Heap – LOB Heap – Loader Heap • Stack • Unmanaged Heap • Memory Fragmentation
  24. 24. Analyze High Memory Usage • Performance Counters Logs– if there is one • Memory Dumps • Thread Statistics – Dead Threads, Blocking Finalizer • Loader Heap Stats • GC Heap Stats • LOB Heap Stats • Cache/Session/ViewState in ASP.NET • GDI Handles • GCHandles
  25. 25. Demo – High Memory Usage
  26. 26. Debugging Silverlight • Production Debugging in Silverlight • CoreCLR • Is Exception/Performance/High Memory Usage any different? • WinDbg/SOS for Silverlight
  27. 27. Debugging Silverlight • Silverlight Spy – courtesy http://silverlightspy.com/silverlightspy/downl oad-silverlight-spy/ • Fiddler – HTTP Debugging Proxy • Browser Memory Dump • WinDbg and sos for silverlight
  28. 28. Silverlight Debugging in Action
  29. 29. Silverlight Buggy App
  30. 30. Cool Features in CoreCLR SOS • DML support • AnalyzeOOM • VerifyObj • FindRoots • GCWhere • ListNearObj • HeapStat • GC History
  31. 31. Demo Debugging Silverlight Application using WinDbg
  32. 32. Debugging Resources Debugging Tidbits http://www.debuggingblog.com The best ASP.NET Debugging Blog http://blogs.msdn.com/tess My Favorite blog in Native Debugging http://www.dumpanalysis.org Debugging ToolBox/Scripts/Cool Debugging Tips http://blogs.msdn.com/debuggingtoolbox Advanced Windows Debugging Blog http://blogs.msdn.com/ntdebugging/
  33. 33. Microsoft Gold Certified Partner • Consulting Services • Software Development • Education and Training Please Visit us at http://www.sftsrc.com
  34. 34. Q&A Q&A
  35. 35. SoftSource Consulting Portland Code Camp - 2009

×