Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Startup Crash in _HandleCreateWindow on 1.8 Stable #10211

Closed
DHowett opened this issue May 26, 2021 · 30 comments · Fixed by #10260
Closed

Startup Crash in _HandleCreateWindow on 1.8 Stable #10211

DHowett opened this issue May 26, 2021 · 30 comments · Fixed by #10260
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-0 Bugs that we consider release-blocking/recall-class (P0) Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. Severity-Crash Crashes are real bad news.

Comments

@DHowett
Copy link
Member

DHowett commented May 26, 2021

Windows Terminal version (or Windows build number)

1.8.144444

Other Software

No response

Steps to reproduce

No idea.

Expected Behavior

No response

Actual Behavior

Look at Watson bucket 4ba5cd02-f285-99e4-6254-56f3218146c9 or failure ID 5133fdab-7a9f-5853-f23d-43d441146a6c. 3,000 hits in the last few days.

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels May 26, 2021
@DHowett DHowett added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Priority-0 Bugs that we consider release-blocking/recall-class (P0) Product-Terminal The new Windows Terminal. Severity-Crash Crashes are real bad news. Issue-Bug It either shouldn't be doing this or needs an investigation. and removed Needs-Tag-Fix Doesn't match tag requirements labels May 26, 2021
@DHowett DHowett added this to the Terminal v1.10 milestone May 26, 2021
@DHowett DHowett added zPreview-Service-Queued-1.13 A floating label that tracks the current Preview version for servicing purposes. zStable-Service-Queued-1.12 A floating label that tracks the current Stable version for servicing purposes. labels May 26, 2021
@DHowett
Copy link
Member Author

DHowett commented May 26, 2021

The crash is at AppHost.cpp:373:

    auto initialSize = _logic.GetLaunchDimensions(dpix);

@mhutch
Copy link
Member

mhutch commented May 26, 2021

I think I may be seeing this. I have a 100% reproducible crash on startup that started today and the bucket ID in the .wer file matches. Is there any additional information I could provide that would help?

@DHowett
Copy link
Member Author

DHowett commented May 26, 2021

@mhutch ooh, excellent. A Time Travel trace from WinDbgX (if you have access to it) of starting the Microsoft.WindowsTerminal app package would be the most helpful thing! Or, any dumps from your machine for WindowsTerminal.exe before Watson gets hold of them.

Or, your settings file from LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_xyzxyxyzyxyzyx\LocalSettings might at least provide an interesting lead 😄

@skyclamp
Copy link

skyclamp commented May 27, 2021

I have got consistent crashes on my box.
Removed everything in Microsoft.WindowsTerminal_8wekyb3d8bbwe fixed these crashes.
My tweaks are "initialCols","initialRows","fontSize" and "antialiasingMode"

--updates--
After started terminal, I edited settings.json using sublime, added my changes back, terminal works like before again with no crash

@Ai-Himmel
Copy link

@DHowett Same issue .
A dump here
WindowsTerminal.exe.26552.zip

@mitchellrj
Copy link

Not sure if this is the same error, but WT 1.8.1444 is crashing on startup for me, unless launched with the --help flag.

Event Viewer shows:

Faulting application name: WindowsTerminal.exe, version: 1.8.2105.24004, time stamp: 0x60ac2e94
Faulting module name: ucrtbase.dll, version: 10.0.19041.789, time stamp: 0x2bd748bf
Exception code: 0xc0000409
Fault offset: 0x000000000007286e
Faulting process ID: 0x6bc4
Faulting application start time: 0x01d752da2dd0acd4
Faulting application path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.8.1444.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe
Faulting module path: C:\WINDOWS\System32\ucrtbase.dll
Report ID: 7f624378-e80d-463a-9934-5274c0e3a95b
Faulting package full name: Microsoft.WindowsTerminal_1.8.1444.0_x64__8wekyb3d8bbwe
Faulting package-relative application ID: App

@Bigpet
Copy link

Bigpet commented May 27, 2021

Had the same issue with the stack overflow

Deleted local settings, still crashed

Deleted %APPDATA%..\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalCache , then it worked again like nothing happened

@kevingosse
Copy link

Not sure if this is the same error, but WT 1.8.1444 is crashing on startup for me, unless launched with the --help flag.

Event Viewer shows:

Faulting application name: WindowsTerminal.exe, version: 1.8.2105.24004, time stamp: 0x60ac2e94
Faulting module name: ucrtbase.dll, version: 10.0.19041.789, time stamp: 0x2bd748bf
Exception code: 0xc0000409
Fault offset: 0x000000000007286e
Faulting process ID: 0x6bc4
Faulting application start time: 0x01d752da2dd0acd4
Faulting application path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.8.1444.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe
Faulting module path: C:\WINDOWS\System32\ucrtbase.dll
Report ID: 7f624378-e80d-463a-9934-5274c0e3a95b
Faulting package full name: Microsoft.WindowsTerminal_1.8.1444.0_x64__8wekyb3d8bbwe
Faulting package-relative application ID: App

Same one here. It's worth nothing that it happened right after rebooting to install KB5000736, but it could be unrelated.

@kevingosse
Copy link

So that's a bit crazy. I did a first session with Windbg:

(33c4.6a70): C++ EH exception - code e06d7363 (first chance)
(33c4.6a70): C++ EH exception - code e06d7363 (first chance)
(33c4.6a70): C++ EH exception - code e06d7363 (first chance)
(33c4.6a70): C++ EH exception - code e06d7363 (first chance)
E:\BA\90\s\src\renderer\dx\DxFontRenderData.cpp(756)\Microsoft.Terminal.Control.dll!00007FFD7A651FAF: (caller: 00007FFD7A651918) Exception(1) tid(6a70) 88985004 A font file exists but could not be opened due to access denied, sharing violation, or similar error.
(33c4.6a70): C++ EH exception - code e06d7363 (first chance)
(33c4.6a70): C++ EH exception - code e06d7363 (first chance)
E:\BA\90\s\src\renderer\dx\DxFontRenderData.cpp(378)\Microsoft.Terminal.Control.dll!00007FFD7A681401: (caller: 00007FFD7A64A892) ReturnHr(1) tid(6a70) 88985004 A font file exists but could not be opened due to access denied, sharing violation, or similar error.
    Msg:[E:\BA\90\s\src\renderer\dx\DxFontRenderData.cpp(756)\Microsoft.Terminal.Control.dll!00007FFD7A651FAF: (caller: 00007FFD7A651918) Exception(1) tid(6a70) 88985004 A font file exists but could not be opened due to access denied, sharing violation, or similar error.
] 
E:\BA\90\s\src\renderer\dx\DxRenderer.cpp(1956)\Microsoft.Terminal.Control.dll!00007FFD7A64A8B1: (caller: 00007FFD7A5E3CCF) ReturnHr(2) tid(6a70) 88985004 A font file exists but could not be opened due to access denied, sharing violation, or similar error.
E:\BA\90\s\src\cascadia\TerminalControl\TermControl.cpp(2808)\Microsoft.Terminal.Control.dll!00007FFD7A5E3DFD: (caller: 00007FFD7A5E3A0E) Exception(2) tid(6a70) 88985004 A font file exists but could not be opened due to access denied, sharing violation, or similar error.
(33c4.6a70): C++ EH exception - code e06d7363 (first chance)
(33c4.6a70): C++ EH exception - code e06d7363 (first chance)
Microsoft.Terminal.Control.dll!00007FFD7A67A116: ReturnHr(3) tid(6a70) 88985004 A font file exists but could not be opened due to access denied, sharing violation, or similar error.
    Msg:[E:\BA\90\s\src\cascadia\TerminalControl\TermControl.cpp(2808)\Microsoft.Terminal.Control.dll!00007FFD7A5E3DFD: (caller: 00007FFD7A5E3A0E) Exception(2) tid(6a70) 88985004 A font file exists but could not be opened due to access denied, sharing violation, or similar error.
] 
(33c4.6a70): Windows Runtime Originate Error - code 40080201 (first chance)
(33c4.6a70): C++ EH exception - code e06d7363 (first chance)
(33c4.6a70): C++ EH exception - code e06d7363 (first chance)
TerminalApp.dll!00007FFD1832D0D6: ReturnHr(1) tid(6a70) 88985004 A font file exists but could not be opened due to access denied, sharing violation, or similar error.
    Msg:[winrt::hresult_error: A font file exists but could not be opened due to access denied, sharing violation, or similar error.] 
(33c4.6a70): C++ EH exception - code e06d7363 (first chance)
(33c4.6a70): Security check failure or stack buffer overrun - code c0000409 (!!! second chance !!!)
Subcode: 0x7 FAST_FAIL_FATAL_APP_EXIT 
ucrtbase!abort+0x4e:
00007ffd`aff6286e cd29            int     29h

Following that, I configured Windbg to break on first-chance exceptions and launched another session. The "A font file exists but could not be opened" error did not occur again, and... The app works now, with or without Windbg. I don't know what fixed it. I did delete the LocalCache folder at some point, but I'm fairly sure it was still crashing afterwards.

@Rhipeus
Copy link

Rhipeus commented May 27, 2021

Had the same issue with the stack overflow

Deleted local settings, still crashed

Deleted %APPDATA%..\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalCache , then it worked again like nothing happened

I tried deleting both LocalCache and LocalState but no luck. I then deleted all of %APPDATA%..\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe and launched fine. Copied my old profile back in and it is running exactly as I want it to.

@zadjii-msft
Copy link
Member

Oh no

Line 2808:

TermControl::GetProposedDimensions
->        THROW_IF_FAILED(dxEngine->UpdateFont(desiredFont, actualFont));

But in general, the Terminal usually updates the font via Renderer::TriggerFontChange, which does this as a LOG_IF_FAILED.

@DHowett did we update cascadia code in 1.8 stable as well? I wonder if that's what's causing these errors to crop up.

Switching to a LOG_IF_FAILED seems reasonable for a fix. We won't crash in startup, we just (likely) will load with the wrong size.

@DHowett
Copy link
Member Author

DHowett commented May 27, 2021

YES! I didn't realize that's why that was failing!

Two things: 1. we should ABSOLUTELY just start with a best-guess character cell size scaled for DPI. 2. I bet this is failing to read Cascadia.ttf because ACCESS_DENIED on the app upgrade path somewhere in @miniksa's "manual font fallback" code.

Can we fix both of these?

@zadjii-msft
Copy link
Member

zadjii-msft commented May 27, 2021

Yea what I want to do is hopefully just fall back to consolas or whatever. I think in the rest of the TermControl, we just gracefully move on here, ignoring the error, and then looking up the font we fell back to. Methinks that'll work in this case too.

Only thing is getting a repro on this. I don't really want to much with the permissions on a font file, so I'm wondering if I can repro this with "fontFace": "garbage"

EDIT: shoot, I couldn't. hmmmm.

@DHowett
Copy link
Member Author

DHowett commented May 27, 2021

Yeah. This codepath is only hit when the OS fails to find Cascadia in the font cache and we manually load it from disk. This is a hard one to hit organically.

@zadjii-msft
Copy link
Member

I wonder if I copy-pasta cascadia.ttf to garbage.ttf, and lock that file, if that'll work...

@DHowett DHowett removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label May 27, 2021
@jimmylewis
Copy link

FWIW, I ran into this when the Windows Store updated my Terminal to 1.8. Cascadia was not recognized in the Windows Settings -> Font Settings until I rebooted my machine, upon which Windows Terminal also started working again. Just wanted to post this in case others come across this thread ("try turning it off and on again").

@HowardWolosky
Copy link
Member

On one of my machines after the update to 1.8.1444. it would open up fine to my default PowerShell tab, but any new tabs opened after that would crash it. On another machine, it crashed before showing any tabs.

To temporarily stay unblocked, I installed Windows Windows Terminal Preview (1.9.1445) on those machines to use in the interim. In a completely unexpected turn of events, as soon as I installed Preview on each machine, stable (1.8.1444) started functioning just fine again. Is Preview registering Cascadia globally upon install?

@miniksa
Copy link
Member

miniksa commented May 27, 2021

Related #10243

@zadjii-msft
Copy link
Member

the underlying font bug was MSFT:32337657, which I think is fixed in 22380. That being said, this might also be a new underlying bug with the platform, hard to say for sure.

@mccormick-wooden
Copy link

I'm receiving the same issues described here. Deleting %localappdata% did not seem to help for me.

Faulting application name: WindowsTerminal.exe, version: 1.8.2105.24004, time stamp: 0x60ac2e94
Faulting module name: ucrtbase.dll, version: 10.0.19041.789, time stamp: 0x2bd748bf
Exception code: 0xc0000409
Fault offset: 0x000000000007286e
Faulting process id: 0x23f4
Faulting application start time: 0x01d753cf27ae2aad
Faulting application path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.8.1444.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe
Faulting module path: C:\Windows\System32\ucrtbase.dll
Report Id: 6ee7e449-331a-4597-95e0-a39ab3165ffa
Faulting package full name: Microsoft.WindowsTerminal_1.8.1444.0_x64__8wekyb3d8bbwe
Faulting package-relative application ID: App

@ghost ghost added the In-PR This issue has a related PR label May 28, 2021
@DHowett
Copy link
Member Author

DHowett commented May 28, 2021

So, there are a couple root causes to this recent startup crash regression.

  1. During an upgrade, our font file is somehow both (1) locked and (2) not registered with the system [likely because of (1)]. We added code to try to fall back to the font file on disk in case (2), which is now failing because of case (1).
  2. The same problem, but for one of the DLLs in our package (which should just not be possible) 😬

@MalcolmEvershed
Copy link

I ran Process Monitor during the crash and saw this event:

High Resolution Date & Time: ...
Event Class: File System
Operation: CreateFile
Result: DELETE PENDING
Path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.7.1033.0_x64__8wekyb3d8bbwe\CascadiaMono.ttf
TID: ...
Duration: ...
Desired Access: Generic Read
Disposition: Open
Options: Synchronous IO Non-Alert, Non-Directory File, Random Access
Attributes: n/a
ShareMode: Read, Write, Delete
AllocationSize: n/a

Note the DELETE PENDING. I guess that explains how the font open fails.

I don't know why it would be in that state. I just booted up my machine and ran Windows Terminal.

What's interesting is that the WindowsTerminal.exe that is running is version 1.8.1444.0:

C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.8.1444.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe

But the font file being accessed is from version 1.7.1033.0:

C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.7.1033.0_x64__8wekyb3d8bbwe\CascadiaMono.ttf

Why is the new version of Windows Terminal accessing the old font file (which is DELETE PENDING probably because of some auto-upgrade process)?

@DHowett
Copy link
Member Author

DHowett commented May 28, 2021

@MalcolmEvershed that's a mystery to us, which we're tracking over in #10243. We trusted the platform to provide a stable update experience and yet, we end up with PE files and fonts coming from the old version. It's a madhouse.

@ghost ghost closed this as completed in #10260 May 28, 2021
ghost pushed a commit that referenced this issue May 28, 2021
I cannot for the life of me repro the original bug. I've got fonts with bad permissions SxS, I've tried installing a font twice, I've tried stopping the font cache service. No idea how to manually repro the original bug.

BUT theoretically, this function should never throw. So lets just switch this to a `LOG_IF_FAILED`, and hope that this goes away? 

* [x] Fixes #10211?
* [x] built & ran manually.

Unclear if this can get cherry-picked trivially to 1.8. Code's pretty trivial though so if we need another PR for that, it can be arranged.
@ghost ghost added Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed In-PR This issue has a related PR labels May 28, 2021
@jcmrva
Copy link

jcmrva commented May 29, 2021

I'm experiencing this (same bucket ID), as of today. None of the following make any difference:

  • repair
  • deleting everything in Microsoft.WindowsTerminal_8wekyb3d8bbwe
  • launching different profiles
  • running as admin

Faulting application name: WindowsTerminal.exe, version: 1.8.2105.24004, time stamp: 0x60ac2e94
Faulting module name: ucrtbase.dll, version: 10.0.19041.789, time stamp: 0x2bd748bf
Exception code: 0xc0000409
Fault offset: 0x000000000007286e
Faulting process id: 0x9560
Faulting application start time: 0x01d754bf8ba26bae
Faulting application path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.8.1444.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe
Faulting module path: C:\windows\System32\ucrtbase.dll
Report Id: 4128a31e-fefb-499d-a042-d05cf8fd8baa
Faulting package full name: Microsoft.WindowsTerminal_1.8.1444.0_x64__8wekyb3d8bbwe
Faulting package-relative application ID: App

@MalcolmEvershed
Copy link

What fixed the issue for me was logging out of Windows and logging in again. No need to reboot.

@tr3pan
Copy link

tr3pan commented May 31, 2021

I can confirm log out and log in again fixed the issue for me too.

@simo-11
Copy link

simo-11 commented Jun 1, 2021

For me repair fixed issue
image

DHowett pushed a commit that referenced this issue Jun 1, 2021
I cannot for the life of me repro the original bug. I've got fonts with bad permissions SxS, I've tried installing a font twice, I've tried stopping the font cache service. No idea how to manually repro the original bug.

BUT theoretically, this function should never throw. So lets just switch this to a `LOG_IF_FAILED`, and hope that this goes away?

* [x] Fixes #10211?
* [x] built & ran manually.

Unclear if this can get cherry-picked trivially to 1.8. Code's pretty trivial though so if we need another PR for that, it can be arranged.

(cherry picked from commit 89ca2ae)
DHowett pushed a commit that referenced this issue Jun 1, 2021
I cannot for the life of me repro the original bug. I've got fonts with bad permissions SxS, I've tried installing a font twice, I've tried stopping the font cache service. No idea how to manually repro the original bug.

BUT theoretically, this function should never throw. So lets just switch this to a `LOG_IF_FAILED`, and hope that this goes away?

* [x] Fixes #10211?
* [x] built & ran manually.

Unclear if this can get cherry-picked trivially to 1.8. Code's pretty trivial though so if we need another PR for that, it can be arranged.

(cherry picked from commit 89ca2ae)
@ghost
Copy link

ghost commented Jul 14, 2021

🎉This issue was addressed in #10260, which has now been successfully released as Windows Terminal v1.9.1942.0.:tada:

Handy links:

@ghost
Copy link

ghost commented Jul 14, 2021

🎉This issue was addressed in #10260, which has now been successfully released as Windows Terminal Preview v1.10.1933.0.:tada:

Handy links:

@miniksa miniksa removed zStable-Service-Queued-1.12 A floating label that tracks the current Stable version for servicing purposes. zPreview-Service-Queued-1.13 A floating label that tracks the current Preview version for servicing purposes. labels Sep 27, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-0 Bugs that we consider release-blocking/recall-class (P0) Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. Severity-Crash Crashes are real bad news.
Projects
None yet
Development

Successfully merging a pull request may close this issue.