Hung process in Windows: Is there any way to see why?

11

1

I tried to print a doc in word, and word froze. Is there any way for me to see what resource it's waiting for?

I'm using windows XP and word 2007 (though I imagine the answer doesn't depend on the process that froze)

Nathan Fellman

Posted 2009-07-21T13:52:51.577

Reputation: 8 152

1

Nathan, I think you double-posted, http://superuser.com/questions/10085/.

– James McMahon – 2009-07-21T13:55:35.647

I did! How embarrassing! – Nathan Fellman – 2009-07-21T17:11:55.967

Answers

13

This requires a little technical knowledge, but it is possible to analyze hangs with the (free) Windows debugger WinDbg. It requires some work to install, attach to the process, and to get the symbols set up (very important!) but then you can find the cause of the hang with a single WinDbg command (emphasis mine):

analyze -v -hang

This is the one which I hadn’t come across before. Run this after opening a dump from a hung process, and it will determine which thread was responsible for the hang and what it was waiting for. I knew windbg could let you examine handles, show all locks open in each thread, and let you examine them all in detail. But I didn’t realise that with !analyse, windbg can do the hard work for me – examining locks held open by all threads, determining which threads are waiting for which others, and build up an order to work out which was initially responsible for the hang.

source

Also Advanced Windows Debugging by Mario Hewardt, Daniel Pravat is a very good book to get you started with WinDbg: The first few chapters give a very detailed overview of debuggers, and how to use WinDbg specifically. The rest of the book is filled with detailed debugging case studies, which you don't have to read. I think there is a case study describing how to debug a hang which will be of interest to you, however.

After you find the cause of the hang, you may even be able to unhang it with more advanced debugging techniques^^

Leftium

Posted 2009-07-21T13:52:51.577

Reputation: 8 163

The case study referred to can be found in chapter 14 of the book, section "!analyze Extension Command". It contains very detailed and useful information on how to interpret WinDbg's output. – Claudiu – 2016-03-04T13:42:49.757

12

You may want to look into Process Explorer. You can see what files/folders processes have a lock on.

James McMahon

Posted 2009-07-21T13:52:51.577

Reputation: 3 010

And if you double click a process, you can even see individual threads and their CPU usage. – itsadok – 2009-07-21T14:24:04.693

1Good suggestion, but note that this will tell you what objects the process has open, not what it's waiting on. – Graeme Perrow – 2009-07-22T11:41:10.997

0

As far as I know, there isn't. You could hook up something like Wireshark to see if you could find something in the network traffic to indicate what it's waiting for, but it's quite a bit overkill and hardly likely you'd find anything.

Stefan Thyberg

Posted 2009-07-21T13:52:51.577

Reputation: 3 925

0

Since its print you were trying, i wonder if the Windows network-search was invoked and Word was just waiting for all the network printers were being mapped for a selection.
Do you have a locally connected Printer? and, are you on an enterprise network domain with shared printers?

nik

Posted 2009-07-21T13:52:51.577

Reputation: 50 788

0

Watch the process explorer videos "The case of the 200x" in which the author shows diagnosing several troubleshooting scenarios including hangs. This is also where the ctrl-scrolllock-scrolllock forced crash can help with diagnosis.

kpierce8

Posted 2009-07-21T13:52:51.577

Reputation: 342