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

Windows Terminal crashing when resizing panes #14254

Closed
VanVan opened this issue Oct 19, 2022 · 21 comments · Fixed by #16939
Closed

Windows Terminal crashing when resizing panes #14254

VanVan opened this issue Oct 19, 2022 · 21 comments · Fixed by #16939
Assignees
Labels
Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Repro We can't figure out how to make this happen. Please help find a simplified repro. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal. Severity-Crash Crashes are real bad news.

Comments

@VanVan
Copy link

VanVan commented Oct 19, 2022

Windows Terminal version

1.16.2642.0 ( and tested also on 1.15.2875.0)

Windows build number

Windows 11 22H2 22621.674 (Windows Feature Experience Pack 1000.22634.1000.0)

Other Software

Powershell not required, the same occur with command line

Steps to reproduce

  • Open Windows Terminal
  • Maximize window to have more space for resizing (optional but makes it easier to reproduce)
  • Split the terminal horizontally (2 pans is enough)
  • Resize right and left pane repeatedly using keyboard shortcuts Alt + Shift + Left and Alt + Shift + Right holding down the right and left keys sometimes.
  • Crash of the app and lost all pans

Expected Behavior

The panes should resize without issues

Actual Behavior

Windows Terminal crashes
We lost all pans at once

@VanVan VanVan added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Oct 19, 2022
@VanVan
Copy link
Author

VanVan commented Oct 19, 2022

This bug is not new and has been reported before but closed for lack of additional information :
#8287

@VanVan
Copy link
Author

VanVan commented Oct 19, 2022

Here is a short video example of a quick crash, sometimes it's slower, and you have to move more, it's random.

Invite.de.commandes.2022-10-19.19-43-07.mp4

@carlos-zamora
Copy link
Member

/feedback

@ghost
Copy link

ghost commented Oct 19, 2022

Hi there!

Can you please send us feedback with the Feedback Hub with this issue? Make sure to click the "Start recording" button, then reproduce the issue before submitting the feedback. Once it's submitted, paste the link here so we can more easily find your crash information on the back end?

Thanks!

image

image

image

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 19, 2022
@carlos-zamora
Copy link
Member

We're having trouble getting a repro. Could you file feedback using the steps above to help us out? That'll give us more insights as to what's going on.

@carlos-zamora carlos-zamora added Needs-Repro We can't figure out how to make this happen. Please help find a simplified repro. Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Severity-Crash Crashes are real bad news. Product-Terminal The new Windows Terminal. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Oct 19, 2022
@VanVan
Copy link
Author

VanVan commented Oct 19, 2022

Hi,
Here is the information requested.

FeedBack Hub Link

events_viewer.zip

Note that this problem does not occur on another of my computers, so there is probably some related configuration.
(Tested with default LocalState\settings.json)

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Oct 19, 2022
@yurizabiyaka
Copy link

same issue Windows Terminal Preview
Version: 1.19.2682.0
Windows 10 pro 22H2/nvidia driver 522.06

@nathan130200
Copy link

nathan130200 commented Mar 17, 2024

Same issue, crashing when resizing the window:

OS Version: Windows 22H2 (Build: 10.0.19045.4170)
Version: 1.19.10573.0

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
	<System>
		<Provider Name="Application Error" /> 
		<EventID Qualifiers="0">1000</EventID> 
		<Version>0</Version> 
		<Level>2</Level> 
		<Task>100</Task> 
		<Opcode>0</Opcode> 
		<Keywords>0x80000000000000</Keywords> 
		<TimeCreated SystemTime="2024-03-17T15:15:02.4093899Z" /> 
		<EventRecordID>36968</EventRecordID> 
		<Correlation /> 
		<Execution ProcessID="0" ThreadID="0" /> 
		<Channel>Application</Channel> 
		<Computer>DESKTOP-75JEN6A</Computer> 
		<Security /> 
	</System>
	<EventData>
		<Data>WindowsTerminal.exe</Data> 
		<Data>1.19.2402.26003</Data> 
		<Data>65dce3ea</Data> 
		<Data>ntdll.dll</Data> 
		<Data>10.0.19041.3996</Data> 
		<Data>39215800</Data> 
		<Data>c0000409</Data> 
		<Data>00000000000a4ff8</Data> 
		<Data>1c20</Data> 
		<Data>01da787de07e564e</Data> 
		<Data>C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.19.10573.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe</Data> 
		<Data>C:\Windows\SYSTEM32\ntdll.dll</Data> 
		<Data>8e65b1a0-ba1e-4ba4-9e59-697701a82c32</Data> 
		<Data>Microsoft.WindowsTerminal_1.19.10573.0_x64__8wekyb3d8bbwe</Data> 
		<Data>App</Data> 
	</EventData>
</Event>

@mer30hamid
Copy link

Same issue, crashing when resizing the window:

OS Version: Windows 22H2 (Build: 10.0.19045.4170) Version: 1.19.10573.0

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
	<System>
		<Provider Name="Application Error" /> 
		<EventID Qualifiers="0">1000</EventID> 
		<Version>0</Version> 
		<Level>2</Level> 
		<Task>100</Task> 
		<Opcode>0</Opcode> 
		<Keywords>0x80000000000000</Keywords> 
		<TimeCreated SystemTime="2024-03-17T15:15:02.4093899Z" /> 
		<EventRecordID>36968</EventRecordID> 
		<Correlation /> 
		<Execution ProcessID="0" ThreadID="0" /> 
		<Channel>Application</Channel> 
		<Computer>DESKTOP-75JEN6A</Computer> 
		<Security /> 
	</System>
	<EventData>
		<Data>WindowsTerminal.exe</Data> 
		<Data>1.19.2402.26003</Data> 
		<Data>65dce3ea</Data> 
		<Data>ntdll.dll</Data> 
		<Data>10.0.19041.3996</Data> 
		<Data>39215800</Data> 
		<Data>c0000409</Data> 
		<Data>00000000000a4ff8</Data> 
		<Data>1c20</Data> 
		<Data>01da787de07e564e</Data> 
		<Data>C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.19.10573.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe</Data> 
		<Data>C:\Windows\SYSTEM32\ntdll.dll</Data> 
		<Data>8e65b1a0-ba1e-4ba4-9e59-697701a82c32</Data> 
		<Data>Microsoft.WindowsTerminal_1.19.10573.0_x64__8wekyb3d8bbwe</Data> 
		<Data>App</Data> 
	</EventData>
</Event>

I have disabled Use the new text renderer ("AtlasEngine") and this fixed this problem !
image

@lhecker
Copy link
Member

lhecker commented Mar 20, 2024

@mer30hamid The option to disable AtlasEngine will go away in the future. Could you please assist me in figuring out why it crashes? To do so, please enable AtlasEngine again and send me a crash dump. You can find my email address in my GitHub profile. Here's how to enable crash dumps: https://github.com/microsoft/terminal/wiki/Troubleshooting-Tips#capture-automatically

@mer30hamid
Copy link

@mer30hamid The option to disable AtlasEngine will go away in the future. Could you please assist me in figuring out why it crashes? To do so, please enable AtlasEngine again and send me a crash dump. You can find my email address in my GitHub profile. Here's how to enable crash dumps: https://github.com/microsoft/terminal/wiki/Troubleshooting-Tips#capture-automatically

Done.

@lhecker lhecker self-assigned this Mar 20, 2024
@nathan130200
Copy link

nathan130200 commented Mar 21, 2024

@mer30hamid I've tried didn't worked. I can fix this when i enable software rendering instead of hardware rendering.

After resize, the callstack of crash (i attached vs2022 debugger into crashdump):

 ucrtbase.dll!00007ffc23dcfde6()Unknown
Microsoft.Terminal.Control.dll!operator new(unsigned __int64 size) Line 36C++
 [Inline Frame] Microsoft.Terminal.Control.dll!Microsoft::Console::Render::Atlas::Buffer<DWRITE_GLYPH_OFFSET,4>::allocate(unsigned __int64) Line 276C++
 Microsoft.Terminal.Control.dll!Microsoft::Console::Render::Atlas::Buffer<DWRITE_GLYPH_OFFSET,4>::Buffer<DWRITE_GLYPH_OFFSET,4>(unsigned __int64 size) Line 166C++
 Microsoft.Terminal.Control.dll!Microsoft::Console::Render::Atlas::AtlasEngine::_recreateCellCountDependentResources() Line 595C++
 Microsoft.Terminal.Control.dll!Microsoft::Console::Render::Atlas::AtlasEngine::_handleSettingsUpdate() Line 527C++
 Microsoft.Terminal.Control.dll!Microsoft::Console::Render::Atlas::AtlasEngine::StartPaint() Line 81C++
 Microsoft.Terminal.Control.dll!Microsoft::Console::Render::Renderer::_PaintFrameForEngine(Microsoft::Console::Render::IRenderEngine * const pEngine) Line 122C++
 Microsoft.Terminal.Control.dll!Microsoft::Console::Render::Renderer::PaintFrame() Line 78C++
 Microsoft.Terminal.Control.dll!Microsoft::Console::Render::RenderThread::_ThreadProc() Line 217C++

I managed to combine the options between software rendering/atlas engine to get this results:

Atlas Engine Software Rendering Crash?
On On No
On Off Yes
Off Yes No
Off Off No

Also if i hit multiple times Save button while atlas engine is enabled, also make terminal crash.

VS debugger also points to here as the crash reason:

image

@lhecker
Copy link
Member

lhecker commented Mar 21, 2024

@mer30hamid Thanks! Your terminal is crashing due to a heap corruption. Unfortunately I can't tell what's corrupting your heap. Would you be willing to help me further test this?

If so, one thing I'd like to test is whether Windows Terminal Canary crashes for you. You can install it here: https://aka.ms/terminal-canary-installer
After installing it, make sure it has imported all your settings from your regular Windows Terminal. (Otherwise open the settings file with Ctrl+Shift+, in both applications and copy it over.)

@lhecker
Copy link
Member

lhecker commented Mar 21, 2024

@nathan130200 Your crash is super interesting! Would it be possible to share that crashdump with me? You can find my email address in my GitHub profile. Otherwise, could you tell me what the value of the size parameter is?

@mer30hamid
Copy link

@mer30hamid Thanks! Your terminal is crashing due to a heap corruption. Unfortunately I can't tell what's corrupting your heap. Would you be willing to help me further test this?

If so, one thing I'd like to test is whether Windows Terminal Canary crashes for you. You can install it here: https://aka.ms/terminal-canary-installer After installing it, make sure it has imported all your settings from your regular Windows Terminal. (Otherwise open the settings file with Ctrl+Shift+, in both applications and copy it over.)

I can't install it because my windows version is: windows 10 22H2 Build 19045.4170 and I get this error:

App installation failed with error message: Windows cannot install package Microsoft.WindowsTerminalCanary_1.21.803.0_x64__8wekyb3d8bbwe because this package is not compatible with the device. The package requires OS version 10.0.22000.0 or higher on the Windows.Desktop device family. The device is currently running OS version 10.0.19045.4170. (0x80073cfd)

p.s: When I enable use software rendering the crash does not accur

@lhecker
Copy link
Member

lhecker commented Mar 21, 2024

@mer30hamid Ah sorry, I forgot that the appinstaller had this limitation. I believe the portable .zip should work though. You can get it here: https://aka.ms/terminal-canary-zip-x64

@mer30hamid
Copy link

@mer30hamid Ah sorry, I forgot that the appinstaller had this limitation. I believe the portable .zip should work though. You can get it here: https://aka.ms/terminal-canary-zip-x64

I sent you the crash dump for this version, turning the "Use software rendering" option to "on" , solved the problem again!

@nathan130200
Copy link

nathan130200 commented Mar 25, 2024

@lhecker the size param value is 331, combined with sizeof(DWRITE_GLYPH_OFFSET) * size value is 2648.

Update: I've checked here and if i let windows choose prefered GPU for Terminal, then will use my onboard-gpu and will trigger the crash if Enable software rendering is not enabled while resizing the window. While i manually set to windows use my offboard gpu, don't crash Terminal.

I will send the crashdump.

@lhecker
Copy link
Member

lhecker commented Mar 25, 2024

@nathan130200 Thanks for the dump! It's very helpful, since it contains a reference to the entire AtlasEngine instance at the time of the crash. I've written a response here: #16747 (comment)
In your case, I would recommend to continue using your Nvidia GPU.

By the way, since you say "onboard-gpu", are you sure your have your monitor plugged into your Nvidia GPU? Because if you did, Windows Terminal should've been using your Nvidia GPU by default. I would suggest checking that. 🙂

@nathan130200
Copy link

nathan130200 commented Mar 25, 2024

I've said "on-board GPU" because its a laptop GPU (the chip is soldered onto the motherboard itself), then windows keep switing between HD Graphics (default for non 3d/2d/graphics related) and GeForce 710M (when using directx/opengl stuff).

ApplicationFrameHost_DtREjhOyst.mp4

@lhecker
Copy link
Member

lhecker commented Mar 25, 2024

I have another idea why this may occur and will add a bunch of settings to the Rendering tab to give users more control over this. 🙂

github-merge-queue bot pushed a commit that referenced this issue Mar 26, 2024
This implements `SetForceFullRepaintRendering` and adds a new
`SetGraphicsAPI` function. The former toggles `Present1` on and off
and the latter allows users to explicitly request Direct2D/3D.

On top of these changes I did a minor cleanup of the interface,
because now that DxRenderer is gone we don't need all that anymore.

Closes #14254
Closes #16747

## Validation Steps Performed
* Toggling Direct2D on/off changes colored ligature support ✅
* Toggling Present1 on/off can be observed in a debugger ✅
* Toggling WARP on/off changes GPU metrics ✅

---------

Co-authored-by: Dustin L. Howett <duhowett@microsoft.com>
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Tag-Fix Doesn't match tag requirements label Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Repro We can't figure out how to make this happen. Please help find a simplified repro. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal. Severity-Crash Crashes are real bad news.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants