silverlight and asp.net production debugging presentation

35
SoftSource Consulting Portland Code Camp - 2009

Upload: prashant-sinha

Post on 25-Dec-2014

3.279 views

Category:

Technology


5 download

DESCRIPTION

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

TRANSCRIPT

Page 1: Silverlight and ASP.NET Production Debugging Presentation

SoftSource Consulting

Portland Code Camp - 2009

Page 2: Silverlight and ASP.NET Production Debugging Presentation

Production Debugging of ASP.NET and Silverlight

Prashant SinhaSoftware Architect

SoftSource ConsultingPortland, OR

Contact me – [email protected]

Page 3: Silverlight and ASP.NET Production Debugging Presentation

Introduction

• Debugging Challenges in Production Environment

• Debugging Tools in Production Environment• How to use them?• Demos

Page 4: Silverlight and ASP.NET Production Debugging Presentation

DEMO

We will be using demo from http://debuggingblog.com/demos

Page 5: Silverlight and ASP.NET Production Debugging Presentation

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

Page 6: Silverlight and ASP.NET Production Debugging Presentation

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

Page 7: Silverlight and ASP.NET Production Debugging Presentation

WinDbg/CDB - ADPlus in Action

• Memory dumps• ADPlus Usage• ADPlus Modes of Operation• ADPlus configuration file

Page 8: Silverlight and ASP.NET Production Debugging Presentation

Demo - ADPlus

Page 9: Silverlight and ASP.NET Production Debugging Presentation

Demo - WinDbg

Page 10: Silverlight and ASP.NET Production Debugging Presentation

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

Page 11: Silverlight and ASP.NET Production Debugging Presentation

Worker Process Recycle

• logEventOnRecycle attribute• Memory Based Recycling• Memory Threshold• Overlapped Recycling and their problems• Rapid Fail Protection• Process Orphaning• Periodic Recycle

Page 12: Silverlight and ASP.NET Production Debugging Presentation

Worker Process Recycle in Action

Page 13: Silverlight and ASP.NET Production Debugging Presentation

ASP.NET Worker Process - Crash

Unhandled ExceptionSystem.OutOfMemoryException System.StackOverflowExceptionSystem.ExecutionEngineExceptionHeap Corruption

Page 14: Silverlight and ASP.NET Production Debugging Presentation

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

Page 15: Silverlight and ASP.NET Production Debugging Presentation

SEH – Exception Flow Chart

Page 16: Silverlight and ASP.NET Production Debugging Presentation

SEH – Termination Flow Chart

Page 17: Silverlight and ASP.NET Production Debugging Presentation

Demo – Crash/Unhandled Exception

How to determine root cause in production environment?

Page 18: Silverlight and ASP.NET Production Debugging Presentation

Analyze First Chance Exception

• Event Log• Logs• ADPlus Configuration file and Pseudo Register• Collect Memory Dump on conditional

exception• Analyze Dump using WinDbg

Page 19: Silverlight and ASP.NET Production Debugging Presentation

Demo - First Chance Exception

Unexpected Behavior on First Chance Exception and the root cause analysis in production environment?

Page 20: Silverlight and ASP.NET Production Debugging Presentation

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

Page 21: Silverlight and ASP.NET Production Debugging Presentation

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

Page 22: Silverlight and ASP.NET Production Debugging Presentation

Demo - PAL

PAL – Performance Analysis of Logs

http://www.codeplex.com/PAL

Page 23: Silverlight and ASP.NET Production Debugging Presentation

High Memory Usage(OOM Exception)

• Managed Heap– JIT Code Heap– GC Heap– LOB Heap– Loader Heap

• Stack• Unmanaged Heap• Memory Fragmentation

Page 24: Silverlight and ASP.NET Production Debugging Presentation

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

Page 25: Silverlight and ASP.NET Production Debugging Presentation

Demo – High Memory Usage

Page 26: Silverlight and ASP.NET Production Debugging Presentation

Debugging Silverlight

• Production Debugging in Silverlight• CoreCLR• Is Exception/Performance/High Memory

Usage any different?• WinDbg/SOS for Silverlight

Page 27: Silverlight and ASP.NET Production Debugging Presentation

Debugging Silverlight

• Silverlight Spy – courtesy http://silverlightspy.com/silverlightspy/download-silverlight-spy/

• Fiddler – HTTP Debugging Proxy• Browser Memory Dump• WinDbg and sos for silverlight

Page 28: Silverlight and ASP.NET Production Debugging Presentation

Silverlight Debugging in Action

Page 29: Silverlight and ASP.NET Production Debugging Presentation

Silverlight Buggy App

Page 30: Silverlight and ASP.NET Production Debugging Presentation

Cool Features in CoreCLR SOS

• DML support• AnalyzeOOM• VerifyObj• FindRoots• GCWhere• ListNearObj• HeapStat• GC History

Page 31: Silverlight and ASP.NET Production Debugging Presentation

Demo

Debugging Silverlight Application using WinDbg

Page 32: Silverlight and ASP.NET Production Debugging Presentation

Debugging ResourcesDebugging Tidbitshttp://www.debuggingblog.comThe best ASP.NET Debugging Bloghttp://blogs.msdn.com/tessMy Favorite blog in Native Debugginghttp://www.dumpanalysis.orgDebugging ToolBox/Scripts/Cool Debugging Tipshttp://blogs.msdn.com/debuggingtoolboxAdvanced Windows Debugging Bloghttp://blogs.msdn.com/ntdebugging/

Page 33: Silverlight and ASP.NET Production Debugging Presentation

Microsoft Gold Certified Partner

• Consulting Services• Software Development• Education and Training

Please Visit us at http://www.sftsrc.com

Page 34: Silverlight and ASP.NET Production Debugging Presentation

Q&A

Q & A

Page 35: Silverlight and ASP.NET Production Debugging Presentation

SoftSource Consulting

Portland Code Camp - 2009