How to debug a short hang

What can I do?

When Bob the tester comes, and tells me that the client application sometimes hangs for about 30 seconds, when Bob is doing nothing. This client, and a hand full of other clients are connected to a system of connected servers. The problem could be a busy server or some internal client problem. We have to find out what the client is doing when it get’s busy, for no good reason.

My first idea was that perhaps Bob could use the feature in the task manager in Vista and Windows 7, right click on a process and select Create Dump File.

Automate it?

It would of course be better if we could automate it, it’s not that easy to select a process, right click and choose the right item within 30 seconds.

So then I found a good tool for generating dump files when a windows application is none responsive.

The tool is ProcDump from SysInternals.

ProcDump is a command-line utility whose primary purpose is monitoring an application for CPU spikes and generating crash dumps during a spike that an administrator or developer can use to determine the cause of the spike. ProcDump also includes hung window monitoring (using the same definition of a window hang that Windows and Task Manager use), unhandled exception monitoring and can generate dumps based on the values of system performance counters.

I have used it to catch the cases where TheClient hangs for a number of seconds.

To use it in this case:

  1. Start TheClient
  2. Run ProcDump with the following command line:

“procdump.exe -h -ma TheClient.exe TheClient.hang.dmp”

It will then generate a dump file in the current directory when the application shows as “Not responding”. Then it’s just to bring out WinDbg to find out what was going on.

1 Comment

Leave a Reply