Is it possible to prevent Windows 7 forcing the closure of an unresponsive program?

5

2

Windows 7 seems to be a bit overzealous in closing programs where it thinks the program has stopped responding. Some things just take a long long time, and I have the feeling that it should give things a bit longer before deciding that they are not working anymore.

Can anyone enlighten me as to the criteria that it uses to decide if a program has frozen?

barrymac

Posted 2011-07-17T23:02:22.910

Reputation: 665

Title does not match question. Consider revising one or both for accuracy. ;-) – Synetech – 2011-07-18T00:38:51.520

Done! Any other suggestions? – surfasb – 2011-07-18T01:39:59.153

That’s not what I meant. The title is asking how to prevent Windows from doing something while the question is asking for information about how something works. – Synetech – 2011-07-18T01:46:33.620

Answers

5

There are several criteria. In general, unhandled exceptions are the top killer. There are other errors, but they get pretty technical.

Two, an application becomes unresponsive if messages dispatched to it are not retrieved. Windows attaches a timer to messages to each application. If it is not handled, then that's when you get the unresponsive message.

Three, applications can also explicitly tell Windows to kill the application process give certain non fatal errors. Often this is to prevent data corruption.

Which program is it that hangs?

edit:

Aparently, there is a way to turn this off. By coincidence, I was reading the perfmon team blog and ran into this article. It give steps to explicitly turn off "ghosting" for an application. I'll cut and paste the steps also.

To download the Application Compatibility Toolkit, visit the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/library/aa286552.aspx

To create a custom Application Compatibility database:

  1. Install and run the Compatibility Administrator Tool.

  2. Right-click Custom Database, and then click New.

  3. Right-click the new database, and then click Rename.

  4. Type noghost as the name of the database. (You can name this whatever you want.)

  5. Right-click New Database, click Create New, and then click Application Fix. Type the name of the program to be fixed.

  6. Type the name of the program manufacturer.

  7. Locate and then select the appropriate program (.exe) file.

  8. Click Next.

  9. In the Compatibility Modes window, click None, and then click Next.

  10. In the Compatibility Fixes list, click NoGhost.

  11. Click either Test Run or Finish. Clicking Test Run starts the program with the application compatibility setting. Clicking Finish adds the compatibility fix to your database.

  12. On the File menu, click Save to save the database. Or, copy the database to the C:\Windows\AppPatch folder.

  13. Right-click the database, and then click Install. Or, run the sdbinst c:\windows\apppatch\noghost.sdb -q command to install the database.

I verified the steps myself. . .

surfasb

Posted 2011-07-17T23:02:22.910

Reputation: 21 453

I think this is the most helpful answer in a way. I verified this by leaving the program untouched (imgSeek) for the whole night and sure enough it was not force closed and was still busy in the momrning. imgSeek is a content based image search tool. It may have some scaling issue as I'm running it on a quite large collection of about 20k images. – barrymac – 2011-07-18T15:43:19.460

Yeah, Win7 wanted to help confused users out. But if you know it ain't hung, then I'd ignore the dialog box. So you went with imgSeek. Let me know how it works out. I've been playing with Emir & Caliph. Steep learning curve . . . – surfasb – 2011-07-18T18:46:07.737

I ran across a solution that might help. I editted my answer. – surfasb – 2011-07-18T18:59:37.410

1@barrymac, you may want to contact the authors of imgSeek and tell them about the problem. They may want to (read should) change it so that the processing code is done in a separate thread so that the interface is not blocked. Not only does that avoid the unresponsiveness, but it also has the benefit of making it easy to implement a Pause/Cancel option. – Synetech – 2011-07-19T00:11:54.217

In my case the program went longer before being declared nonresponsive but it still happened. It's a game, the developer is more interested in their next game than fixing problems with the old one. – Loren Pechtel – 2014-01-07T23:45:32.363

2

You can change the timeout period required for Windows to consider an application (or service) as being unresponsive by changing the WaitToKillAppTimeout entry (WaitToKillServiceTimeout for services). This is a per-user setting.

The default is 20,000 milliseconds (20 seconds), so you can try setting it to 30,000 or whatever. Also, you should be able to click Cancel on the End Task dialog to give it more time on demand.

Other related settings that you can change include HungAppTimeout, and AutoEndTasks.

Synetech

Posted 2011-07-17T23:02:22.910

Reputation: 63 242

Yeah, it looks like these are all timeouts for user initiated behavior. WaitToKill is for logoffs. HungAppTimeout is for Taskman Kills. I think the OP was refering to when Windows kills unreponsive UIs, which is 5 seconds. AFAIK, there is no way to change the 5 seconds. – surfasb – 2011-07-18T01:38:07.470

It sounds like Barry is talking about the End Task dialog, in which case, the aforementioned entries are what he needs. – Synetech – 2011-07-18T01:47:20.687

"Windows 7 seems to be a bit overzealous in closing programs where it thinks the program has stopped responding." The End Task dialog shows up if you try to kill a task through TaskMan. I'm pretty sure Barry is refering to the unresponsive dialog. http://i.msdn.microsoft.com/dynimg/IC292438.gif

– surfasb – 2011-07-18T09:58:51.210

Tomato, tomato. – Synetech – 2011-07-18T10:41:22.977

This is very useful information but I don't think it will solve my particular issue. Thank you – barrymac – 2011-07-18T15:44:12.097

2

Windows 7 doesn't make any attempt to close a program that is unresponsive before it reaches the timeout unless you click on it or attempt to perform another task before it has finished with the one it is completing. You may have better luck if you simply wait till the program has finished before clicking on it to start something else.

Changing the timeout will not change that behavior - it only controls how long Windows itself waits, not the user.

Abraxas

Posted 2011-07-17T23:02:22.910

Reputation: 1 269