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

Post on 24-Dec-2015

214 views 0 download

Tags:

transcript

2

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

Tess Ferrandez - NorlanderSupport Escalation EngineerMicrosoft

Session Code: TLA05-IS

3

Tools and Resources

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

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>

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

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

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

8

Performance issues

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

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

10

Crashes

RecyclingUnhandled exceptionsStack overflowFatal Execution Engine ExceptionsHeap CorruptionOut of memory

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

12

High memory usage and OOM

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

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)

14

Garbage collection

Gen 0Gen 1

MarkSweepCompact

Gen 2

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

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

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

Complete anevaluation onCommNet andenter to win!

1 Year Subscription!

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.