depuración de sistemas en producción
DESCRIPTION
Depuración de Sistemas en Producción. Rene Pally Microsoft Corp. Office Server Team European Development Centre. Why Analyze a Crash?. When Windows Error Reporting has no solution or when it blames “a device driver”. Why Does Windows Crash. - PowerPoint PPT PresentationTRANSCRIPT
DEPURACIÓN DE SISTEMASEN PRODUCCIÓN
Rene PallyMicrosoft Corp.Office Server TeamEuropean Development Centre
WHY ANALYZE A CRASH?• When Windows Error Reporting has no solution or when it blames “a
device driver”
WHY DOES WINDOWS CRASH• A device driver or part of the operating system incurs an
unhandled exception• A device driver or part of the operating system explicitly crashes the
system due to an unrecoverable condition• A page fault occurs at an interrupt request level of dispatch or higher• A hardware condition such as a nonmaskable interrupt or faulty memory,
disk, etc.
CAUSES OF WINDOWS CRASHES
Third-party device drivers
70%
Microsoft code13%
Crash too corrupt for
analysis11%
Hardware errors6%
Percentage of Top 500 Crashes for Windows Vista with Service Pack 11
1.Microsoft Corporation. 2008. Online Crash Analysis research performed inSeptember of 2008.
WHAT HAPPENS DURING A CRASH
• When a condition is detected that requires a crash, the kernel API KeBugCheckEx is called
• KeBugCheckEx accepts a bugcheck code that indicates the reason for the crash and four parameters that supply additional information
KeBugCheckEx( IN ULONG BugCheckCode, IN ULONG_PTR BugCheckParameter1, IN ULONG_PTR BugCheckParameter2, IN ULONG_PTR BugCheckParameter3, IN ULONG_PTR BugCheckParameter4 );
INSIDE OF KEBUGCHECKEX• KeBugCheckEx performs several functions
• Disables interrupts• Notifies other CPUs to halt execution• Notifies registered drivers• Writes crash dump information to disk*
• Restarts the system*
* Only if the system is configured to do so
THE WINDOWS STOP SCREEN1
2
3
4
5
MEMORY DUMP TYPES• Small memory dump
• Records the smallest set of useful information• Kernel memory dump*
• Records only kernel memory, which speeds up the process of writing a crash dump
• Complete memory dump*
• Records the entire contents of system memory
* If either a Kernel or Complete memory dump is selected, the system will also create a minidump and store it in the %SystemRoot%\minidump directory
CRASH REPORTING USER INTERFACE
SEND REPORTING USER INTERFACE
HAVE RESPONSE USER INTERFACE• Responses are URLs• Point to fixes, workarounds, troubleshooters, surveys,
and so on.• Example:
https://oca.microsoft.com/en/Response.asp?SID=32
WER Data FlowWatson/OCA
Back End
Portal Siteshttp://dbgportalhttp://watson
http://winqual.microsoft.com
Hotfix
Repo
rt
Fix
Investigate
Categorize
Known
Issue
WER DATA SHARING PROGRAM
PROBLEMAS EN SISTEMAS DE PRODUCCION
INTRODUCCIÓNProblemas en Producción:
-No existe acceso a Interfaces de Desarrollo.
Los clientes prefieren mantener sus ambientes de producción libres de software innecesario.
INTRODUCCIÓNProblemas en Producción:
-Tiempos de Down System Cortos.
No podemos tomarnos el tiempo de dejar nuestro sistema inoperable para poder analizar los problemas que presenta.
INTRODUCCIÓNProblemas en Producción:
-Problemas irreproducibles en Desarrollo / Test
INTRODUCCIÓNDebugging tools for Windows
-Herramientas por excelencia de los ambientes en Producción.
Ventajas
INTRODUCCIÓNDebugging tools for Windows
-Debug Sistemas en Producción y/o Ambientes de Test :
-Acceso a Breakpoints y Manejo Binario de Minidumps
INTRODUCCIÓNDebugging tools for Windows
-Debug Sistemas en Producción y/o Ambientes de Test :
Permite Acceso completo a características internas de un proceso
INTRODUCCIÓNDebugging tools for Windows
-Debug Sistemas en Producción y/o Ambientes de Test :
-Aplicaciones Manejadas y no Manejadas
INTRODUCCIÓNDebugging tools for Windows
-Debug Sistemas en Producción y/o Ambientes de Test :
-Procesos en Runtime.
INTRODUCCIÓNDebugging tools for Windows
-Debug Sistemas en Producción y/o Ambientes de Test :
-Aplicacion Free.
INTRODUCCIÓNAnálisis de Procesos
-Analisis Online (Runtime)
-Analisis Offline (Memory Dump)
INTRODUCCIÓNAnálisis de Procesos
Memory dump es la imagen de la memoria grabada en disco en determinado momento. Puede ser de un sistema completo o de un proceso.
INTRODUCCIÓNProcedimiento para tomar Dumps de Memoria
ADPLUS.VBS incluido con Windows Debugging Tools
INTRODUCCIÓNProcedimiento para tomar Dumps de Memoria
windows Debugging Tools .dump /mfht
INTRODUCCIÓNProcedimiento para tomar Dumps de Memoria
Su propia aplicación puede crear su propio dump en caso de problemas
INTRODUCCIÓNCrear Memory Dumps Programaticamente
-DbgHelp.dll que es una libreria redistribuible.
INTRODUCCIÓNCrear Memory Dumps Programaticamente
[DllImport("DbgHelp.dll", SetLastError=true)] private static extern bool MiniDumpWriteDump( IntPtr hProcess, int processId, IntPtr fileHandle, int dumpType, IntPtr excepInfo, IntPtr userInfo, IntPtr extInfo); public static void CreateMiniDump(int pid, string outputFileName) { using (FileStream stream = new FileStream(outputFileName, FileMode.Create, FileAccess.ReadWrite)) { using (Process proc = Process.GetProcessById(pid)) { int dumpType = (int)0x00000306; MiniDumpWriteDump(proc.Handle, proc.Id, stream.Handle, dumpType, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); } } }
INTRODUCCIÓNImportancia de Crear Mecanismos de Creacion de Memory Dumps
-Los problemas en producción pueden llegar a ser complejos de detectar
INTRODUCCIÓNImportancia de Crear Mecanismos de Creacion de Memory Dumps
- Información sobre Problemas graves de procesos puede llegar a perderse
INTRODUCCIÓNImportancia de Crear Mecanismos de Creacion de Memory Dumps
- Memory Dumps guardan información de las estructuras de datos y clases en el momento del bug.
INTRODUCCIÓNImportancia de Crear Mecanismos de Creacion de Memory Dumps
-Event Log y los propios de la aplicacion llegan a ser insuficientes
INTRODUCCIÓNArchivos de Simbolos (PDB)
-Portable Database
PREGUNTAS
DEBUGGING EN VIVO DE UNA APLICACIÓN
INTRODUCCIÓNUtilidades Incluidas en Windows Debugger
-Incluye SDK para Windows Debugger Extensibility
INTRODUCCIÓNUtilidades Incluidas en Windows Debugger
-DBGENG.DLL para la creacion programatica de Memory Dumps
INTRODUCCIÓNUtilidades Incluidas en Windows Debugger
-gflags
INTRODUCCIÓNWindows Debugging Labo 1
- Familiarizandose con Windows Debugger
INTRODUCCIÓNWindows Debugging Labo 1
- Ejecución de Procesos con Windows Debugger Notepad
INTRODUCCIÓNBreakpoints en Windows Debugging
- BP Breakpoint - BM
- BA- BU
INTRODUCCIÓNWindows debugging Labo 2
- Explorando las funciones que exporta el proceso CMD
x cmd!*
INTRODUCCIÓNWindows debugging Labo 2
- Trazado de procesos wt
INTRODUCCIÓNWindows debugging Labo 2
- Que realmente se ejecuta internamente cuando ejecutamos un simple DIR?
breakpoint en BP cmd!dir
INTRODUCCIÓNProcesos Hijo
-.childdbg 1-SXE CPR
-Navegación entre procesos hijo
INTRODUCCIÓNProcesos Hijo
-cmd open notepad / Open calc
-!peb
-~ threads
CARRERAS EN MICROSOFT• Software Developers.• Software Developers in Test• Escalation Engineers.• Muchas posibilidades si el candidato posee skills en: Algoritmia, Out-of-
the-box thinking.• Excelentes habilidades de conocer el software internamente.
SOFTWARE TESTING BOLIVIA• Comunidad creada en Facebook para compartir conocimiento.• Buscar por : Software testing Bolivia.• Objetivo: compartir conocimiento y mas adelante dar a conocer
oportunidades de trabajo nacionales e internacionales.• Solo solicitar ingreso a la comunidad.