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

11,783

Solution 1

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. . .

Solution 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.

Solution 3

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.

Share:
11,783

Related videos on Youtube

jota3
Author by

jota3

Studied Computational Chemistry originally but went programming to make a living. Been at it since primary school. Have been developing web applications with Java professionally for the last 10 years or so, as well as others such as groovy , python.

Updated on September 18, 2022

Comments

  • jota3
    jota3 almost 2 years

    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?

    • Synetech
      Synetech almost 13 years
      Title does not match question. Consider revising one or both for accuracy. ;-)
    • surfasb
      surfasb almost 13 years
      Done! Any other suggestions?
  • surfasb
    surfasb almost 13 years
    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.
  • Synetech
    Synetech almost 13 years
    It sounds like Barry is talking about the End Task dialog, in which case, the aforementioned entries are what he needs.
  • surfasb
    surfasb almost 13 years
    "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. i.msdn.microsoft.com/dynimg/IC292438.gif
  • jota3
    jota3 almost 13 years
    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.
  • jota3
    jota3 almost 13 years
    This is very useful information but I don't think it will solve my particular issue. Thank you
  • surfasb
    surfasb almost 13 years
    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
    surfasb almost 13 years
    I ran across a solution that might help. I editted my answer.
  • Synetech
    Synetech almost 13 years
    @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.
  • Loren Pechtel
    Loren Pechtel over 10 years
    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.