microsoft / microsoft/terminal

Terminal Preview Hanging On Startup

Open
#18,610 5 comments 1 reaction 0 assignees View on GitHub
Area-UserInterface Issue-Bug Needs-Tag-Fix Product-Terminal Severity-Crash
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

### Windows Terminal version

1.23.10353.0

### Windows build number

22631.4890

### Other Software

_No response_

### Steps to reproduce

I don't know what is causing it. For me it happens right now any time I try to open the terminal in any way at all.

### Expected Behavior

The terminal opens and does not peg a CPU core.

### Actual Behavior

As of today, my Windows Terminal Preview build has started hanging on every startup, spinning the CPU. I also noticed similar behavior with Terminal Canary starting several months ago, so I had to switch to Preview which was working at the time... But now Preview also has the same behavior...

![Image](https://github.com/user-attachments/assets/57b000e0-1f08-4f31-94fe-472e9b007943)

I am now debugging it with windbg, and it seems this thread has the highest usage:

![Image](https://github.com/user-attachments/assets/24baa9a3-8aad-4cbf-80a1-a0b0b25a3de8)

If we let it run and randomly break now and then we see a similar stack trace every time with a call to TerminalApp!Pane::LayoutSizeNode::operator=

![Image](https://github.com/user-attachments/assets/77942127-a4d1-45e6-a238-c953edbbb09c)

![Image](https://github.com/user-attachments/assets/fe50d6b3-4c29-43d2-a677-3506a1382e56)

![Image](https://github.com/user-attachments/assets/cb8867be-8059-4b49-ae15-2eab79845ade)

That leaves me to believe this is some kind of endless loop somewhere within this call trace.

I have `firstWindowPreference": "persistedWindowLayout"` enabled in my config. Here is redacted version of my `state.json` file:
```json
{
"dismissedMessages" :
[
"deprecated",
"closeOnExitInfo"
],
"generatedProfiles" :
[
"{REDACTED}",
"{REDACTED}",
"{REDACTED}",
"{REDACTED}"
],
"persistedWindowLayouts" :
[
{
"initialPosition" : "0,-14",
"initialSize" :
{
"height" : 880.4444580078125,
"width" : 1536
},
"launchMode" : "maximized",
"tabLayout" :
[
{
"action" : "newTab",
"commandline" : "REDACTED",
"profile" : "REDACTED",
"sessionId" : "{REDACTED}",
"startingDirectory" : "REDACTED",
"suppressApplicationTitle" : false,
"tabTitle" : "REDACTED"
},
{
"action" : "splitPane",
"commandline" : "REDACTED",
"profile" : "REDACTED",
"sessionId" : "{REDACTED}",
"size" : 0.5,
"split" : "right",
"splitMode" : "manual",
"startingDirectory" : "REDACTED",
"suppressApplicationTitle" : false,
"tabTitle" : "REDACTED"
},
{
"action" : "splitPane",
"commandline" : "REDACTED",
"profile" : "REDACTED",
"sessionId" : "{REDACTED}",
"size" : 0.5,
"split" : "down",
"splitMode" : "manual",
"startingDirectory" : "REDACTED",
"suppressApplicationTitle" : false,
"tabTitle" : "REDACTED"
},
{
"action" : "focusPane",
"id" : 0
},
"togglePaneZoom",
{
"action" : "newTab",
"commandline" : "REDACTED",
"profile" : "REDACTED",
"sessionId" : "{REDACTED}",
"startingDirectory" : "REDACTED",
"suppressApplicationTitle" : false,
"tabTitle" : "REDACTED"
},
{
"action" : "switchToTab",
"index" : 0
}
]
}
],
"recentCommands" :
[
"ls"
],
"settingsHash" : "REDACTED"
}
```

Contributor guide

Open the contributing guide

Research direction

The report points to TerminalApp::Pane::LayoutSizeNode::operator= and a persistedWindowLayouts entry in state.json. Start by reproducing startup with firstWindowPreference set to persistedWindowLayout and inspecting the reported call trace. Done means Preview starts without pegging a CPU core for this configuration, with the regression verified appropriately.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli, desktop, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.