One report of a runaway RegOpen/Query loop #10793

Closed
opened 2026-01-31 02:30:28 +00:00 by claunia · 8 comments
Owner

Originally created by @vefatica on GitHub (Sep 26, 2020).

Environment

Microsoft Windows 10 Pro for Workstations
10.0.18363.1082 (1909)
WindowsTerminalPreview_1.4.2652.0_x64

Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd]
Windows Terminal version (if applicable):

Any other software?

Steps to reproduce

Expected behavior

Actual behavior

Right now WT has one tab, one pane, and one command processor idling. It's using about 3.5 seconds of CPU (kernel + user) every minute, by far the busiest process I have after for "System Idle Process". ProcessExplorer is monitoring all categories and reporting over 100 events per second. They look like this.

image

Originally created by @vefatica on GitHub (Sep 26, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment Microsoft Windows 10 Pro for Workstations 10.0.18363.1082 (1909) WindowsTerminalPreview_1.4.2652.0_x64 ```none Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd] Windows Terminal version (if applicable): Any other software? ``` # Steps to reproduce <!-- A description of how to trigger this bug. --> # Expected behavior <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> # Actual behavior <!-- What's actually happening? --> Right now WT has one tab, one pane, and one command processor idling. It's using about 3.5 seconds of CPU (kernel + user) every minute, by far the busiest process I have after for "System Idle Process". ProcessExplorer is monitoring all categories and reporting over 100 events per second. They look like this. ![image](https://user-images.githubusercontent.com/61856645/94345312-00932300-fff3-11ea-8ecd-cfb95072a0ec.png)
claunia added the Issue-BugResolution-DuplicateProduct-TerminalArea-Performance labels 2026-01-31 02:30:29 +00:00
Author
Owner

@vefatica commented on GitHub (Sep 26, 2020):

I'm not so sure about that RegOpen/Query thing. WT seems to do that a lot and I'm not very good at interpreting what ProcessMonitor is showing. This thread is probably not aptly titled. One thing is for sure, opening and closing split panes ups the subsequent CPU use. You need some sort of tool to see this.

One way is with ProcessExplorer. Start WT and ProcessExplorer. In ProcessExplorer, open WindowsTerminal.exe, go to the "Threads" tab and watch WT's main thread (here that's WindowsTerminal.exe+0x12AD0). After startup and settledown, and while idling, "CyclesDelta" is in the neighborhood of 10,000,000 (here anyway). Now open and close a split pane 5 times (close it with the "exit" command). Here, "CyclesDelta" (idling) is now in the 50,000,000 range. Open/close 5 more. "CyclesDelta" is now in the 100,000,000 range.

If you can automate the opening/closing of split panes you can get more get striking results. I've had TaskMgr showing a constant 4% CPU for an idling WT.

@vefatica commented on GitHub (Sep 26, 2020): I'm not so sure about that RegOpen/Query thing. WT seems to do that a lot and I'm not very good at interpreting what ProcessMonitor is showing. This thread is probably not aptly titled. One thing is for sure, opening and closing split panes ups the **subsequent** CPU use. You need some sort of tool to see this. One way is with ProcessExplorer. Start WT and ProcessExplorer. In ProcessExplorer, open WindowsTerminal.exe, go to the "Threads" tab and watch WT's main thread (here that's WindowsTerminal.exe+0x12AD0). After startup and settledown, and while idling, "CyclesDelta" is in the neighborhood of 10,000,000 (here anyway). Now open and close a split pane 5 times (close it with the "exit" command). Here, "CyclesDelta" (idling) is now in the 50,000,000 range. Open/close 5 more. "CyclesDelta" is now in the 100,000,000 range. If you can automate the opening/closing of split panes you can get more get striking results. I've had TaskMgr showing a constant 4% CPU for an idling WT.
Author
Owner

@DHowett commented on GitHub (Sep 29, 2020):

This is weird! We don't actually use those anywhere in Terminal, directly, so this smells like a framework issue. I can't explain why the system would be querying for display scaling every .03 seconds.

@DHowett commented on GitHub (Sep 29, 2020): This is weird! We don't actually use those anywhere in Terminal, directly, so this smells like a framework issue. I can't explain why the system would be querying for display scaling every .03 seconds.
Author
Owner

@vefatica commented on GitHub (Sep 29, 2020):

As I said I'm not sure the increase in CPU use is related to the registry thing (see my second post). Maybe when the buffer is too small it's increased only modestly ... try again ... increase again ... try again ... until it works. That's what my pic might be showing. That sort of thing also seems to happen with other registry queries.

But there's definitely increased CPU usage AFTER opening and closing a split pane. You only have to do a few to see a difference. If you have ProcessExplorer, try my experiment. There's a small memory leak too but that's harder to detect.

@vefatica commented on GitHub (Sep 29, 2020): As I said I'm not sure the increase in CPU use is related to the registry thing (see my second post). Maybe when the buffer is too small it's increased only modestly ... try again ... increase again ... try again ... until it works. That's what my pic might be showing. That sort of thing also seems to happen with other registry queries. But there's definitely increased CPU usage AFTER opening and closing a split pane. You only have to do a few to see a difference. If you have ProcessExplorer, try my experiment. There's a small memory leak too but that's harder to detect.
Author
Owner

@DHowett commented on GitHub (Sep 29, 2020):

To be fair, I'm responding to the issue you reported and put in the title 😉

@DHowett commented on GitHub (Sep 29, 2020): To be fair, I'm responding to the issue you _reported and put in the title_ :wink:
Author
Owner

@vefatica commented on GitHub (Sep 29, 2020):

Yes I realize that. And I admitted earlier that the thread may not be aptly titled.

@vefatica commented on GitHub (Sep 29, 2020): Yes I realize that. And I admitted earlier that the thread may not be aptly titled.
Author
Owner

@vefatica commented on GitHub (Dec 21, 2020):

This appears to be the same issue as #8625. It does not seem to be related to any Reg* loop.

@vefatica commented on GitHub (Dec 21, 2020): This appears to be the same issue as #8625. It does not seem to be related to any Reg* loop.
Author
Owner

@DHowett commented on GitHub (Feb 17, 2021):

Oh, I see. Thanks for identifying the duplicate -- you can tell how far back I am in triaging. /dup #8625.

@DHowett commented on GitHub (Feb 17, 2021): Oh, I see. Thanks for identifying the duplicate -- you can tell how far back I am in triaging. /dup #8625.
Author
Owner

@ghost commented on GitHub (Feb 17, 2021):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Feb 17, 2021): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#10793