Documente Academic
Documente Profesional
Documente Cultură
5 5/13/06
Name Title Group Microsoft Corporation
Agenda
Introduction A look at Debug Diagnostics Dig into crash scenarios Understanding hangs Investigating memory leaks Session Summary
Introduction
Overview of Debugging: Past and Present Integral tools for resolving Debug scenarios Variables impacting Debugging
Overview of Debugging
Past and Present
Past: offered many tools, fewer resolutions
Previous tools were often not server-ready No single tool to address different debugging scenarios Required expertise in debugging
These extensible parts are often integrated and executing in same process
Service is multipurposed
Interacts with the Debugger Host Allows:
Service required to attach invasively to process To run from Terminal Services
DbgSvc.exe
To register the service: C:\DebugDiag> DbgSvc /service
To start the service: C:\DebugDiag> net start DbgSvc
Host
Where the DbgEng.dll instance is loaded Exposes 3 classes
DbgSvc.exe
Attac h
DbgHost.exe
DbgControl: Attach/Detach from processes or open/analyze a memory dump DbgObj: Collect process or memory dump information Manager: Mainly to output analysis data to the report file
DebugDiag.exe
Crash Scenarios
Background of crashes Using DebugDiag to quickly identify root cause of crashes
Background: Exceptions
What is an exception?
How do applications cause exceptions What is a handled exception? Unhandled exceptions need debugging and resolution
Access Violation: C000 0005
Breakpoint Exception: 8000 0003 Stack Overflow: C000 00FD C++ exception: E06D7363 Managed exception: E0434F4D Invalid Handle: C000 0008
Heap Corruption:
Certain rules must be followed when using the heap When rules are violated, heap corruption occurs Heap corruption crashes Code that corrupts heap is usually not the ones impacted
Hang Scenarios
Investigating the theory of process hangs Using DebugDiag to debug process hangs
What is a thread?
An independent sequence of instructions executing within a process
Runaway Threads
A runaway thread is a thread stuck in a infinite (or near) loop
Performing a task that is consuming CPU Either by design or because of error conditions
SQL
Session Summary
Debugging Live Web Applications without downtime is challenging
Crashes cause processes to terminate due to unhandled exceptions Hangs are caused due to race conditions, lock contention, network blocking, database blocking, infinite loops and deadlocks Leaks are caused by the failure to release memory allocated beyond typical short term allocations and caching Debug Diagnostics has an extensibility model that allows it to successfully capture and analyze common debugging scenarios to determine the root cause Know what DebugDiag can doand also what it cant do