Handling dates in single-page applications Type compatibility pitfalls in TypeScript

Hunting down a power configuration bug in Windows 10

Published on Sunday, March 18, 2018 6:00:00 AM UTC in Skit & Tools & User Experience

I have a new "hobby" that I've been actively pursuing for the past weeks: hunting down what keeps waking up my computer at night. At first it simply was a matter of me not wanting to shut down the computer completely (I like my five hundred open windows be restored instantly), but I also didn't want it to just sit there and idling along, consuming power for nothing. But the more I tried to solve this issue, the worse it got, seemingly. I once turned it off in the morning, and when I left for work half an hour later, it was already running again. I swear it mocked me. Getting this under control turned into a mission, a mankind vs. machines class of battle. In the end, it turned out to be a bug in Windows 10 that seems at least two years old, and it made finding the cause for these problems a nerve-wrecking journey for me. If you also find your computer waking up spontaneously at night and already tried out all the hints, configuration switches and registry settings you could find on the internet, this one might be for you.

I'm quite familiar with the workings of power management options of the OS, so whenever I turned to Google to bing my problem, I first had to rifle through the dozens of hits where most-trivial "solutions" were provided. At some point for example, I basically stopped reading Microsoft's forums. I'm not saying people are not providing good help there. Users obviously are receiving answers there too. But it simply makes you cringe when the first reply to even well-crafted questions of obviously tech-savy users often is a "Microsoft moderator" advising a clean boot, wrapped in a two-hundred words statement. Cutting a long story short, things I did to resolve this included, among many others:

  • Make sure no device intentionally or accidentally wakes up the computer (typical candidates: mouse, network interface etc.).
  • Turn off all options on the OS level that allow the computer to wake up (hint: there are multiple ones in Windows 10).
  • Go through the scheduled tasks to make sure none of them are allowed to wake the computer.
  • Try a few promising registry settings that I could confirm have or had actual relevance through MS documentation (you'd be surprised how much outdated or even never working stuff is still actively promoted by "experts").

When you're like me, some of these things become hard work because... I don't simply turn things off. I first want to understand why they were turned on in the first place, to make sure I'm not doing something stupid. Finding information on a particular scheduled task of a particular patch level of your OS and then judging whether it's OK to keep it turned off is not an easy task. Second, I'm curious enough that I want to find out what the actual cause was, so I don't try out everything at once. Change something, wait. The next morning, gulp down your hot coffee in anger when you realize the 'puter is running, again (9th day in a row, yay). But I guarantee you, if you find the culprit, it's most satisfying. If you don't, well, better grow a thick skin quickly. But now, on to the details!

The Situation

After all of the above, powercfg was down to a single, very cryptic message when I queried for waketimers:

powercfg /waketimers

It spit out a single entry that claimed a "Maintenance Activator" task is active and will wake the computer (some time at night). This task could not be found anywhere in the scheduled tasks list, and all searching on the net pointed to a setting in the control panel, very accessible and easily discoverable located under:

Security and Maintenance / Maintenance / Automatic Maintenance / Change maintenance settings

The problem: on my system, this setting was already off:

image-1.png

Turning it on and off again had no effect.

Starting to give up

With no emerging solution, I started thinking about simply giving up. I wanted to do a re-install of my computer anyway (said no one ever, but that's what you tell yourself in these situations). What I did first though, was undo most of the things I had tried, step by step, because none of them had helped anyway. And then, by accident, I found it.

I re-enabled the "allow wake timers" option of all power plans, like this:

image-2.png

Returning to the "Automatic Maintenance" section I mentioned above, the screen now showed the following:

image-3.png

What the...?

The option. Was. Active.

The Solution

Once you know the solution, the problem becomes trivial. Armed with the above information I could easily find more people confirming this bug, for example on Reddit.

I also had wake timers disabled in power settings, and wake for maintenance was unchecked. When I enabled wake timers in power settings, the checkbox became checked.

This is was from August 25th, 2016, but apparently still is very relevant today:

  • If you turn off "allow wake timers" in your power plans,
  • the "wake for maintenance" checkbox is cleared even though the option is still active!

Even more: now there doesn't seem a reliable way to actually turn it off - do'h!

Once I removed the checkbox, powercfg finally came back clean:

C:\WINDOWS\system32>powercfg waketimers
There are no active wake timers in the system.

...and I haven't had an undesired wake-up of my computer in half a week - yay!

Tags: Fail · Powercfg · Standby · Windows 10