Web342 improved iis debugging debug diagnostics 1 0
1 / 38

WEB342 Improved IIS Debugging Debug Diagnostics 1.0 - PowerPoint PPT Presentation

  • Uploaded on

WEB342 Improved IIS Debugging Debug Diagnostics 1.0. Chris Adams Web Platform Supportability Lead Web Platform & Tools Microsoft Corporation. Getting to know you…. Are you a developer?. Are you a IT professional?. Hybrid?. Session Agenda. Introduction Dig into crash scenarios

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'WEB342 Improved IIS Debugging Debug Diagnostics 1.0' - cree

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Web342 improved iis debugging debug diagnostics 1 0 l.jpg

WEB342Improved IIS DebuggingDebug Diagnostics 1.0

Chris Adams

Web Platform Supportability Lead

Web Platform & Tools

Microsoft Corporation

Getting to know you l.jpg
Getting to know you…

Are you a developer?

Are you a IT professional?


Session agenda l.jpg
Session Agenda

  • Introduction

  • Dig into crash scenarios

  • Understanding hangs

  • Investigating memory leaks

  • Debug Diagnostics extensibility

  • Session Summary

Introduction l.jpg

  • Overview of Debugging: Past and Present

  • Integral tools for resolving Debug scenarios

  • Variables impacting Debugging

Overview l.jpg

  • 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

  • Present: more advanced tools, still time-consuming to solve

    • Still lacks any analytical piece

    • Existing tools are not “integrated” into single tool

    • Do you really want to learn “debugging?”

Talking about tools l.jpg

Does this Scare you?

Talking about tools…

  • There are several tools designed at resolving the same problems

  • As Windows Servers have grown, so have the debugging tools

  • Example of debugging tools

Variables impacting debugging l.jpg
Variables Impacting Debugging

  • IIS is a “application platform”

    • The server is easily extensible

    • Extensibility examples include such things as proxy servers, publishing components, request handlers, and many, many more

    • Extensible platforms are robust but might be difficult to diagnose problems

    • Debugging is the worst-case scenario for any platform

Variables impacting debugging 2 l.jpg
Variables Impacting Debugging (2)

  • IIS’s Extensibility Examples

    • ISAPI

    • ASP.NET

    • Active Server Pages (ASP)

    • COM components

  • These “extensible” parts are often integrated and executing in same process

Crash scenarios l.jpg
Crash Scenarios

  • Background of crashes

  • Defining and demonstrating crashes in worker processes: debugging crashes today

  • Using DebugDiag to quickly identify root cause of crashes

Background exceptions l.jpg
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:


Managed exception:


Invalid Handle:

C000 0008

Background heap 2 l.jpg
Background: Heap (2)

  • What is a heap?

    • Heap is a data structure

  • 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

Debugging crashes today l.jpg
Debugging Crashes Today

  • Crash symptoms usually include a event in the event viewer

  • If Dr. Watson is enabled, crashes often create memory.dmp

  • Memory.dmp is a snapshot of the crashing process to be analyzed post-mortem

Debugging crashes with debug diagnostics l.jpg

Debugging Crashes with Debug Diagnostics

Kamal Balakrishnan

Solutions Architect

Microsoft IPTV

Hang scenarios l.jpg
Hang Scenarios

  • Investigating the theory of “process hangs”

  • Debugging hangs today

  • Using DebugDiag to debug “process hangs”

Theory of process hangs l.jpg
Theory of “Process Hangs”

  • What is a process?

    • Memory boundary for execution of code

    • Allocated by Operating System done by calling CreateProcess or CreateProcessAsUser API

    • Processes do not execute code

    • Contains a minimum of 1 thread

  • What is a thread?

    • An independent sequence of instructions executing within a process

Theory of process hangs 2 l.jpg
Theory of “Process Hangs” (2)

  • Thread implications on applications

    • The level of concurrency (virtual) is dictated by the number of threads

    • Real concurrency is dictated by the number of execution units

      • 1 processor = one or more execution units

What are common thread pools for IIS?

  • ATQ thread pool

  • ASP thread pool

  • ASP.NET thread pool

Theory of process hangs 3 l.jpg
Theory of “Process Hangs” (3)

  • ISAPI Extensions are recommended to implement custom thread pools

    • ATQ Thread pool is sensitive and high- performing

    • Blockage of threads in ATQ because of long execution can have harsh effects on IIS

    • ISAPIs often have long execution hence custom thread pools offload work from ATQ

Runaway threads l.jpg
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

  • Runaway thread is taking CPU resources away from other threads

    • Often takes away from good threads

    • Causes performance degradation for server

Defining a blocked thread l.jpg



Defining a Blocked Thread

  • A thread that isn’t using any CPU resources

    • Waiting on database calls to return

    • Waiting on web service calls to return

    • Waiting on a socket/network call to return

    • Waiting on a lock









Locks and deadlocks l.jpg
Locks and Deadlocks

  • What is a lock?

    • A synchronization mechanism to protect resources from being corrupted due to simultaneous access by multiple threads

  • Why do developers use locks?

    • Protecting data

    • Protecting other resources that are not memory based

  • Impact on applications if locks are poorly implemented

    • Causes threads to block

    • Can cause deadlock situations when using multiple locks in the application

    • Process hangs when no threads are available

Debugging deadlocks and process hangs with debugdiag l.jpg

Debugging Deadlocks and Process Hangs with DebugDiag

Kamal Balakrishnan

Solutions Architect

Microsoft IPTV

Looking into leaks l.jpg
Looking into Leaks…

  • What is a leak?

  • Types of Leaks

Leak scenarios 2 l.jpg
Leak Scenarios (2)

  • Why are leaks difficult to identify and resolve?

    • Server applications often cache memory allocations

    • The allocations are long term

    • These applications, to outsiders, look to have memory leaks

  • There are many other caches

    • Using Performance Monitor and seeing memory growth does not equal a memory leak

Leak scenarios 3 l.jpg
Leak Scenarios (3)

  • What are short-term allocations?

    • Memory expensive applications use “spike” allocations but are destroyed immediately after request (not long- sustaining)

These are not Memory Leaks

Leak scenarios 4 l.jpg
Leak Scenarios (4)

  • Difference between cache and memory leaks?

    • Memory leaks are caused by unbounded allocations

    • Cache memory usage rises quickly, but tops out after application is stabilized

Nailing a memory leak in a web application using debugdiag l.jpg

Nailing a Memory Leak in a Web Application using DebugDiag

Kamal Balakrishnan

Solutions Architect

Microsoft IPTV

Extensibility of debugdiag l.jpg
Extensibility of DebugDiag

  • Introduction to extensibility

  • DebugDiag architecture & object model

  • The role of scripts in DebugDiag

  • The role of extensions in DebugDiag

  • Customizing and extending DebugDiag

Extensibility of debugdiag29 l.jpg
Extensibility of DebugDiag

  • DebugDiag has two ways to be extended

    • Data Collection

    • Analytical

  • Data Collection extensibility

    • Control Scripts

    • Both types of control scripts act as event handlers

Extensibility of debugdiag30 l.jpg
Extensibility of DebugDiag

  • DebugDiag uses rules to generate scripts

    • Scripts can be modified and extended

    • All control scripts are written in VBScript

    • Scripts easily can interface and call into any automation compatible COM objects

Extensibility of debugdiag31 l.jpg
Extensibility of DebugDiag

  • Analytical Scripts

    • Are written in “ASP+HTML” similar style

    • Are not processed by ASP.dll and does not have exposed ASP intrinsic

    • Scripts can be modified and customized based on environment

  • Base Object Model for Analytical Scripts

    • Base Object Model is consumed by the scripts

    • Entire object model can be extended

Extensibility of debugdiag32 l.jpg
Extensibility of DebugDiag

  • DebugDiag will ship with a IIS-specific extension

    • This extension was written to the SDK specifications

    • This IIS specific extension provides all information needed about IIS for DebugDiag

Building and using a custom extension for debugdiag l.jpg

Building and Using a Custom Extension for DebugDiag

Kamal Balakrishnan

Solutions Architect

Microsoft IPTV

Session summary l.jpg
Session Summary

  • Debugging Live Web Applications without downtime is challenging

  • Web Applications are complex a integration of components from Microsoft, in-house development and third party vendors making it hard to isolate root cause of crashes, hangs and leaks

  • 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

Resources l.jpg

IIS Diagnostics Toolkit


IIS Webcast Series


TechEd IIS Sessions Remaining:

Web340: Preview of IIS 7.0

3:45 PM – S330

Debug Diagnostics Cabana Session:

Friday, June 10th - 10:45 AM to 12:00 PM


Iis debugging week l.jpg
IIS Debugging Week

  • Don’t miss the IIS Debugging Week in the IIS Webcast Series

  • Learn DebugDiag in more detail from the experts

June 20, 2005 – June 24, 2005

Slide37 l.jpg

Your Feedbackis Important!

Please Fill Out a Survey forThis Session on CommNet

Slide38 l.jpg

© 2005 Microsoft Corporation. All rights reserved.

This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.