microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.27k stars 8.27k forks source link

Windows Terminal crashing when resizing panes #14254

Closed VanVan closed 6 months ago

VanVan commented 1 year ago

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

Expected Behavior

The panes should resize without issues

Actual Behavior

Windows Terminal crashes We lost all pans at once

VanVan commented 1 year ago

This bug is not new and has been reported before but closed for lack of additional information : https://github.com/microsoft/terminal/issues/8287

VanVan commented 1 year ago

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

https://user-images.githubusercontent.com/388581/196767243-c24c24fa-50f9-4aa9-8695-e94c4f3211cb.mp4

carlos-zamora commented 1 year ago

/feedback

ghost commented 1 year ago

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

carlos-zamora commented 1 year ago

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.

VanVan commented 1 year ago

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)

yurizabiyaka commented 11 months ago

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

nathan130200 commented 7 months ago

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 commented 6 months ago

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 commented 6 months ago

@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 commented 6 months ago

@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.

nathan130200 commented 6 months ago

@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 commented 6 months ago

@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 commented 6 months ago

@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 commented 6 months ago

@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 commented 6 months ago

@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 commented 6 months ago

@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 commented 6 months ago

@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 commented 6 months ago

@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: https://github.com/microsoft/terminal/issues/16747#issuecomment-2017980996 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 commented 6 months ago

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).

https://github.com/microsoft/terminal/assets/14365254/562c76b5-7851-42dd-b688-cbe439e1dfb9

lhecker commented 6 months ago

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. 🙂