Prev: VECTORCAST
Next: COMP.DSP 2010 conference update
From: David Brown on 18 Mar 2010 03:42 On 18/03/2010 05:34, George Neuner wrote: > On Thu, 18 Mar 2010 10:09:05 +1000, Tom<tom(a)no.spam.invalid> wrote: > >> >> Be aware that in Windows some applications may refuse [to shut down]and >> OS will not shut down. We had to look for a workaround for UPS to shutdown >> a PC with Citect Scada running on it. > > There is a registry setting that forces termination of hung processes > instead of displaying a message and waiting until doomsday for a user > response. > > There is also a "hung process" timeout value which controls when the > auto kill kicks in. This is separate from the normal process shutdown > timeout. > > See: > http://www.addictivetips.com/windows-tips/how-to-speed-up-windows-shutdown-process/ > Processes that are not hung can actively choose to block the shutdown in Windows - then they need to be closed manually (either through the application itself, or killing it with task manager). It is also possible for processes in windows to become unkillable. I've seen this happen with software that talks to USB devices, and doesn't handle device disconnections properly, or software that doesn't handle network hiccups well. As far as I know, the reset button is the only way to stop these processes.
From: Jim Stewart on 18 Mar 2010 12:11 Jim Stewart wrote: > I know that if you push the power button on a > running PC, the machine does not power down > until the OS has done its shutdown silly walk. Thanks for all the informative posts. Got everything I needed and more. -jim
From: Brendan Gillatt on 18 Mar 2010 13:43 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 David Brown wrote: > It is also possible for processes in windows to become unkillable. I've > seen this happen with software that talks to USB devices, and doesn't > handle device disconnections properly, or software that doesn't handle > network hiccups well. As far as I know, the reset button is the only > way to stop these processes. > Yup, I've had that several times. It often happens with Microchip MPLAB and the ICD2 debugger. An easy fix is just to unplug the USB peripheral. - -- Brendan Gillatt | GPG Key: 0xBF6A0D94 brendan {a} brendangillatt (dot) co (dot) uk http://www.brendangillatt.co.uk -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (MingW32) iD8DBQFLomZVHEhZ5Ws5poERAqBlAKCnupo+iH+sRjliD4uNkxVApSqcKACgpd1F kI7C71/qKYq8KBj6XgfK060= =Hk8p -----END PGP SIGNATURE-----
From: George Neuner on 18 Mar 2010 18:23 On Thu, 18 Mar 2010 08:42:41 +0100, David Brown <david(a)westcontrol.removethisbit.com> wrote: >On 18/03/2010 05:34, George Neuner wrote: >> On Thu, 18 Mar 2010 10:09:05 +1000, Tom<tom(a)no.spam.invalid> wrote: >> >>> >>> Be aware that in Windows some applications may refuse [to shut down]and >>> OS will not shut down. We had to look for a workaround for UPS to shutdown >>> a PC with Citect Scada running on it. >> >> There is a registry setting that forces termination of hung processes >> instead of displaying a message and waiting until doomsday for a user >> response. >> >> There is also a "hung process" timeout value which controls when the >> auto kill kicks in. This is separate from the normal process shutdown >> timeout. >> >> See: >> http://www.addictivetips.com/windows-tips/how-to-speed-up-windows-shutdown-process/ >> > >Processes that are not hung can actively choose to block the shutdown in >Windows - then they need to be closed manually (either through the >application itself, or killing it with task manager). Yes, both processes can refuse WM_QUERYENDSESSION *unless* the shutdown request specifies that they be forced closed. The registry setting "AutoEndTasks" terminates processes that are either hung or which refuse to shut down. Once the process continues past the relevant timeout period - "WaitToKillAppTimeout" for normal processes or "WaitToKillServiceTimeout" for services - it is nuked with prejudice. AutoEndTasks results in the shell calling InitiateSystemShutdown(Ex)() with the parameter bForceAppsClosed = true. Applications are first asked to shut down (QUERYENDSESSION) and are forced if they refuse or do not answer within the timeout period. If the process answers QUERYENDSESSION affirmative, ENDSESSION is sent normally so the process can exit gracefully. AutoEndTasks is _not_ the same as ExitWindowEx() with EWX_FORCE, which sends neither QUERYENDSESSION nor ENDSESSION but rather terminates processes immediately. "AutoEndTasks" can result in loss of data if processes refuse to shut down when asked. Processes need to catch ENDSESSION if they must shut down gracefully. You can always reply affirmative to QUERYENDSESSION and start your graceful shut down - the process won't be terminated until after it returns from ENDSESSION. >It is also possible for processes in windows to become unkillable. I've >seen this happen with software that talks to USB devices, and doesn't >handle device disconnections properly, or software that doesn't handle >network hiccups well. As far as I know, the reset button is the only >way to stop these processes. No question, drivers can hang and require a hardware reset. It doesn't matter how carefully they are written ... if the hardware is at all flaky - which plug-n-play things have a penchant for - the driver can get messed up. However, none of this stops a properly written application from terminating gracefully. "It's stuck waiting on the driver ... " is, IMO, a lame excuse. George
From: David Brown on 19 Mar 2010 04:14
On 18/03/2010 23:23, George Neuner wrote: > On Thu, 18 Mar 2010 08:42:41 +0100, David Brown > <david(a)westcontrol.removethisbit.com> wrote: > >> On 18/03/2010 05:34, George Neuner wrote: >>> On Thu, 18 Mar 2010 10:09:05 +1000, Tom<tom(a)no.spam.invalid> wrote: >>> >>>> >>>> Be aware that in Windows some applications may refuse [to shut down]and >>>> OS will not shut down. We had to look for a workaround for UPS to shutdown >>>> a PC with Citect Scada running on it. >>> >>> There is a registry setting that forces termination of hung processes >>> instead of displaying a message and waiting until doomsday for a user >>> response. >>> >>> There is also a "hung process" timeout value which controls when the >>> auto kill kicks in. This is separate from the normal process shutdown >>> timeout. >>> >>> See: >>> http://www.addictivetips.com/windows-tips/how-to-speed-up-windows-shutdown-process/ >>> >> >> Processes that are not hung can actively choose to block the shutdown in >> Windows - then they need to be closed manually (either through the >> application itself, or killing it with task manager). > > Yes, both processes can refuse WM_QUERYENDSESSION *unless* the > shutdown request specifies that they be forced closed. > > The registry setting "AutoEndTasks" terminates processes that are > either hung or which refuse to shut down. Once the process continues > past the relevant timeout period - "WaitToKillAppTimeout" for normal > processes or "WaitToKillServiceTimeout" for services - it is nuked > with prejudice. > > AutoEndTasks results in the shell calling InitiateSystemShutdown(Ex)() > with the parameter bForceAppsClosed = true. Applications are first > asked to shut down (QUERYENDSESSION) and are forced if they refuse or > do not answer within the timeout period. If the process answers > QUERYENDSESSION affirmative, ENDSESSION is sent normally so the > process can exit gracefully. > > AutoEndTasks is _not_ the same as ExitWindowEx() with EWX_FORCE, which > sends neither QUERYENDSESSION nor ENDSESSION but rather terminates > processes immediately. > > "AutoEndTasks" can result in loss of data if processes refuse to shut > down when asked. Processes need to catch ENDSESSION if they must shut > down gracefully. You can always reply affirmative to QUERYENDSESSION > and start your graceful shut down - the process won't be terminated > until after it returns from ENDSESSION. > And people say that Linux is hard to understand... Thanks for that information - this is perhaps worth trying if something gets stuck in the future. It seems strange that the AutoEndTask behaviour is not enabled by default - if you ask the system to shut down, you want all the programs to be stopped no matter what it takes. And forcefully killing them like this is still much nicer than the reset or power button, which is the only alternative. Is there any way to kill individual applications more forceably than can be done with task manager (or process explorer, etc.)? i.e., can you get the AutoEndTask effect but only apply it to one hung process without shutting down the whole system? A sort of "kill -9" for windows. > >> It is also possible for processes in windows to become unkillable. I've >> seen this happen with software that talks to USB devices, and doesn't >> handle device disconnections properly, or software that doesn't handle >> network hiccups well. As far as I know, the reset button is the only >> way to stop these processes. > > No question, drivers can hang and require a hardware reset. It > doesn't matter how carefully they are written ... if the hardware is > at all flaky - which plug-n-play things have a penchant for - the > driver can get messed up. > > However, none of this stops a properly written application from > terminating gracefully. "It's stuck waiting on the driver ... " is, > IMO, a lame excuse. > > George |