Powertoys: 0.20.1: Powertoys uses 100% of a CPU core and becomes unresponsive when task manager is opened

Created on 11 Aug 2020  ·  11Comments  ·  Source: microsoft/PowerToys

ℹ Computer information

  • Windows build number: 1909 (Build 18363.997)
  • PowerToys version: 0.20.1
  • PowerToy module: maybe fancy zones?

📝 Provide detailed reproduction steps (if any)

  1. Start Powertoys
  2. open task manager and move it
  3. get the message about a program running with administrator privileges
  4. See in task manager that powertoys is now using a full core and it doesn't react to anything any more (settings window can't be opened, fancy zones do nothing, etc...)

✔️ Expected result

Powertoys continue working.

❌ Actual result

Powertoys hangs in an infinite loop.

My guess is that it is somehow related to fancy zones, as it only starts hanging as I actually move the task manager.

Issue-Bug Product-FancyZones Resolution-Fix-Committed

All 11 comments

@treo
just to make sure, can you go to the Task Manager Details tab and take a screen shot showing the PowerToys.exe CPU usage?
Thanks.

before moving it:
image

after moving it:
image

12% is what is about 100% of a single cpu core / hyperthread on this machine.

@treo
can you try opening the Settings and go to the FancyZones tab before the problem occurs, then after the problem happens, try to turn off FancyZones in the Settings, does it work?

image
I can disable it, but it stays in that loop.

OK thank you.

@treo
just to be 100% sure it's FancyZones that causes the problem, can you turn off all the other modules and reproduce the problem? Thanks.

Did that, and it still reproduces.

Also, it doesn't have to be task manager apparently other software that runs with admin privileges will trigger this too.

PowerToys is running with just user privileges though.

I'm having this same issue.

I don't know what should be happening in the code, but I did trace what is happening. The call below to WindowMoveHandlerPrivate::MoveSizeUpdate() which is inside WindowMoveHandlerPrivate::MoveSizeUpdate() is causing an infinite recursion:

https://github.com/microsoft/PowerToys/blob/40a4a6a1a83d701c86d75f8bfb9bee540d9ef00a/src/modules/fancyzones/lib/WindowMoveHandler.cpp#L289-L295

In debug builds, it leads to a quick stack overflow. In release builds, it's a tail recursion which the compiler optimizes away, leading instead to an infinite loop.

I "fixed" it by adding a second check here:

    else if (m_dragEnabled)
    {
        MoveSizeStart(m_windowMoveSize, monitor, ptScreen, zoneWindowMap);
        if (m_dragEnabled)
        {
            MoveSizeUpdate(monitor, ptScreen, zoneWindowMap);
        }
    }

I quoted "fixed" because I have no idea what the correct way to fix this issue is, only that the above works for me. The call to MoveSizeStart() eventually calls WarnIfElevationIsRequired() which sets m_dragEnabled = false iff the window is elevated, and it apparently works, but there could be a better way.

@gurnec
thank you very much for debugging this.

This should be resolved in our 0.21.1 release of PowerToys. https://github.com/microsoft/PowerToys/releases/tag/v0.21.1 to download it.

Thanks. Can confirm that it now works as expected here.

Was this page helpful?
0 / 5 - 0 ratings