2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez -...

18

Transcript of 2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez -...

Page 1: 2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.
Page 2: 2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.

2

Debugging Performance Issues, Memory Issues and Crashes in .net Applications

Tess Ferrandez - NorlanderSupport Escalation EngineerMicrosoft

Session Code: TLA05-IS

Page 3: 2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.

3

Tools and Resources

BuggyBits from http://blogs.msdn.com/TessDebugging Tools for WindowsSOS.dllProcess ExplorerVisual Studio Team System TestTinyGet Performance MonitorOur brains

Page 4: 2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.

4

Memory Dumps

Mini DumpsModule InformationThreads InformationStacks

Full DumpsFull memory and handle dataUnloaded module informationThread Time info

adplus –crash –pn <processname.exe>adplus –hang –pn <processname.exe>

Page 5: 2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.

5

SOS.dll

1.1

2.0

For a list of the commands available in sos.dll run !sos.help

.load clr10\sos

.cordll -u –lp <framework dir>

.load <framework dir>\sos.dllor

.loadby sos mscorwks.dll

Page 6: 2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.

6

Symbols

Symbols are used to translate an address into a more understandable function or variable nameWinDbg uses deferred symbol loadingThree types of symbols

PrivatePublicExport

Page 7: 2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.

7

Symbols (cont.)

Symbols can be stored directly in directories or on symbol servers

Symbols are not neccesary to translate .NET function names

.sympath srv*downstreamstore*http://msdl.microsoft.com/download/symbols

Or

.symfix downstreamstore

Page 8: 2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.

8

Performance issues

Low CPU => waiting for external resources and/or locksHigh CPU => busy server, infinite loops or high CPU in GC

Page 9: 2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.

9

Performance issues

High or Low CPU?Get memory dump(s)Look at threads VSTS Test and Profiling is good if you can repro in a test environment

Page 10: 2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.

10

Crashes

RecyclingUnhandled exceptionsStack overflowFatal Execution Engine ExceptionsHeap CorruptionOut of memory

Page 11: 2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.

11

Crashes and Exceptions

Check out the eventviewerDisable recycling optionsGet memory dump(s)Look at faulting stacks or logs if neccesaryUse TrackClr.cfg to track exceptions during testing

Page 12: 2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.

12

High memory usage and OOM

Caching and Session State“Unexpected roots”Blocked finalizerDataSet serializationLarge viewstateAssembly leaks with XmlSerializerPinned objects

Page 13: 2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.

13

High memory usage and OOM

What are you leaking? (native, .net, assemblies)Take multiple dumps when memory is raising and compareCheck the finalizerCheck the Large object heapTry to group “leaking” objectsFigure out why they are sticking around (rooted)

Page 14: 2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.

14

Garbage collection

Gen 0Gen 1

MarkSweepCompact

Gen 2

31 2 5 6 7 98 104 11 12 13 14 15 16

Page 15: 2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.

15

Remember...

There are tools out there to track down these types of issueshttp://blogs.msdn.com/TessTrack exceptions during testing with TrackCLR.cfgDebugging Tools for Windows

Page 16: 2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.

www.microsoft.com/teched Tech·Talks Tech·Ed BloggersLive Simulcasts Virtual Labs

http://microsoft.com/msdn

Developer’s Kit, Licenses, and MORE!

Resources for Developers

Page 17: 2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.

Complete anevaluation onCommNet andenter to win!

1 Year Subscription!

Page 18: 2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.

18

© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED

OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.