If one program blocks shutdown, then all programs block shutdown

Raymond Chen

We’re all in this together, as far as the Blocked Shutdown Resolver (BSDR) is concerned.

If a program blocks the WM_QUERY­END­SESSION or WM_END­SESSION message, then it goes into the Blocked Shutdown Resolver screen. That much is obvious. What is perhaps less obvious is that every other window that hasn’t yet replied to the message also goes into that screen, even if they aren’t the ones that are blocking shutdown.

The system sends the shutdown messages to each window in turn. If a window blocks the message, then not only does it prevent shutdown (for a time at least), but all the other programs which haven’t yet received the WM_QUERY­END­SESSION message are also prevented from receiving it. As a result, all those other programs also go into the BSDR, not because they are doing anything wrong (yet), but because they are stuck in the queue behind the bad guy and therefore could potentially block shutdown in the future.

I assume the theory here is that it’s better to list everybody who could potentially cause a problem, rather than just listing the one who is causing a problem right now, only to frustrate the user when they resolve that problem, only to have a new window show up on the list. Shutting down the system would turn into a game of Whack-a-Mole.

Programs typically block shutdown if they need extra time to clean up (for example, closing a database or disconnecting from a server), or if they need to ask the user what they want to do with unsaved data.

If you click the Shut down anyway button in the Blocked Shutdown Resolver, then the system gives up waiting for responses from WM_QUERY­END­SESSION messages and proceeds with shutdown. The programs that were asking questions will never get the answers, and you may end up with a corrupted database or unsaved data.

If you click Cancel, then the shutdown is canceled and you return to your desktop. You’ll want to click this button if the program is asking you a question that needs to be answered before it will permit shutdown to continue, typically a “Save changes?” dialog.

If you do nothing, then the system will automatically click the Shut down anyway button after a few seconds.

The Blocked Shutdown Resolver was added to address the common problem where you go to the Start menu, click “Shut down”, and then walk away from the computer or close the lid to your laptop. But then you come back to your computer some time later, and the shutdown got stuck because some application got stuck cleaning up or simply rejected the shutdown request, so your computer never shut down at all. In the case of a laptop, this exhausts the battery, which is really frustrating because you’ll pull out your laptop some time later so you can start doing some work and discover that the battery is dead.

One phenomenon you may observe in the Blocked Shutdown Resolver is that of programs gradually disappearing from the list. This is the flip side of the “If one program blocks shutdown, then all programs block shutdown” principle. As each program receives and responds to the WM_QUERY­END­SESSION message, it disappears from the list.

Just because a program is on the list doesn’t mean it’s being bad. It may be on the list because it is still waiting its turn.