Hung process in Windows: Is there any way to see why?
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)
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^^
You may want to look into Process Explorer. You can see what files/folders processes have a lock on.