Windows Terminal hangs up and disappears on window resizing. #13095

Closed
opened 2026-01-31 03:33:45 +00:00 by claunia · 13 comments
Owner

Originally created by @Hamayama on GitHub (Mar 19, 2021).

Environment

Windows build number: 10.0.19042.0
Windows Terminal version (if applicable): 1.6.10571.0

Any other software?

vim 8.2

Steps to reproduce

  1. vim aiueo.txt

    ( aiueo.txt is text file including wide characters. )

  2. Narrowing the window width by mouse.

Expected behavior

The window is resized normally.

Actual behavior

Windows Terminal hangs up (few seconds) and disappears.

( the condition seems to be a line wrapping of wide characters. )

Originally created by @Hamayama on GitHub (Mar 19, 2021). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 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 ```none Windows build number: 10.0.19042.0 Windows Terminal version (if applicable): 1.6.10571.0 Any other software? vim 8.2 ``` # Steps to reproduce <!-- A description of how to trigger this bug. --> 1. vim aiueo.txt ( [aiueo.txt](https://github.com/microsoft/terminal/files/6170588/aiueo.txt) is text file including wide characters. ) 2. Narrowing the window width by mouse. # Expected behavior <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> The window is resized normally. # Actual behavior <!-- What's actually happening? --> Windows Terminal hangs up (few seconds) and disappears. ( the condition seems to be a line wrapping of wide characters. )
claunia added the Resolution-DuplicateProduct-TerminalSeverity-Crash labels 2026-01-31 03:33:46 +00:00
Author
Owner

@Hamayama commented on GitHub (Mar 19, 2021):

3002_winterm_issue_9547_size

@Hamayama commented on GitHub (Mar 19, 2021): ![3002_winterm_issue_9547_size](https://user-images.githubusercontent.com/4497079/111781276-8d140380-88fb-11eb-972b-da13cf1cd974.png)
Author
Owner
@zadjii-msft commented on GitHub (Mar 19, 2021): Well, this could be any of: * #8730 * #8596 * #8287 * #4907 Could you send us a Feedback Hub trace of the crash, to help identify the root cause? /feedback
Author
Owner

@ghost commented on GitHub (Mar 19, 2021):

Hi there!

Can you please send us feedback with the Feedback Hub with this issue and paste the link here so we can more easily find your crash information on the back end?

Thanks!

image image

@ghost commented on GitHub (Mar 19, 2021): Hi there!<br><br>Can you please send us feedback with the Feedback Hub with this issue and paste the link here so we can more easily find your crash information on the back end?<br><br>Thanks!<br><br>![image](https://user-images.githubusercontent.com/18221333/62478757-b69d0d00-b760-11e9-9626-1fa33c91e7c5.png) ![image](https://user-images.githubusercontent.com/18221333/62478649-6de55400-b760-11e9-806e-5aab7e085a9f.png)
Author
Owner

@Hamayama commented on GitHub (Mar 20, 2021):

I sent feedback.

https://aka.ms/AAbm3go

@Hamayama commented on GitHub (Mar 20, 2021): I sent feedback. https://aka.ms/AAbm3go
Author
Owner

@zadjii-msft commented on GitHub (Mar 22, 2021):

@DHowett Is there anyone on the team that can actually still access feedback hub links? Or are we all locked out now 😑

@zadjii-msft commented on GitHub (Mar 22, 2021): @DHowett Is there anyone on the team that can actually still access feedback hub links? Or are we all locked out now 😑
Author
Owner

@DHowett commented on GitHub (Mar 22, 2021):

If I had to simply guess, this is the PrepareForDoubleByteSequence resize crash we know about. @zadjii-msft hit me up on Teams -- there's a way 😄

@DHowett commented on GitHub (Mar 22, 2021): If I had to simply _guess_, this is the `PrepareForDoubleByteSequence` resize crash we know about. @zadjii-msft hit me up on Teams -- there's a way :smile:
Author
Owner

@zadjii-msft commented on GitHub (Mar 26, 2021):

 "providerName": "Microsoft.Windows.Terminal.Control",
 "lineNumber": "286",
 "fileName": "E:\\BA\\3\\s\\src\\buffer\\out\\textBuffer.cpp",
 "hresult": "2147549183",

Yep, it was _PrepareForDoubleByteSequence, which is #7417, which is #4907

/dup #4907

@zadjii-msft commented on GitHub (Mar 26, 2021): ``` "providerName": "Microsoft.Windows.Terminal.Control", "lineNumber": "286", "fileName": "E:\\BA\\3\\s\\src\\buffer\\out\\textBuffer.cpp", "hresult": "2147549183", ``` Yep, it was `_PrepareForDoubleByteSequence`, which is #7417, which is #4907 /dup #4907
Author
Owner

@ghost commented on GitHub (Mar 26, 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 (Mar 26, 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!
Author
Owner

@Hamayama commented on GitHub (Apr 12, 2021):

I understood this issue is a duplicate of #4907.
But, I will try to investigate a little by myself.

  • type aiueo_unicode.txt → resize → no problem

  • vim aiueo_unicode.txt → resize → problem occurs

So, there might be a display conflict with vim and windows terminal.

--
file: aiueo_unicode.txt

@Hamayama commented on GitHub (Apr 12, 2021): I understood this issue is a duplicate of #4907. But, I will try to investigate a little by myself. - type aiueo_unicode.txt → resize → no problem - vim aiueo_unicode.txt → resize → problem occurs So, there might be a display conflict with vim and windows terminal. -- file: [aiueo_unicode.txt](https://github.com/microsoft/terminal/files/6300087/aiueo_unicode.txt)
Author
Owner

@Hamayama commented on GitHub (Apr 12, 2021):

I set up VS2019 and checked the call stack.

  • vim aiueo_unicode.txt → resize
src/buffer/out/textBuffer.cpp
  TextBuffer::Reflow
      ↓
  newBuffer.InsertCharacter
      ↓
  _PrepareForDoubleByteSequence
      ↓
  _AssertValidDoubleByteSequence
    // N, T failing case (uncorrectable) or
    // L, N and L, L failing cases (correctable) or
    // T, T failing case (uncorrectable)
    return false;
      ↓
  _PrepareForDoubleByteSequence
    FAIL_FAST_IF → Unhandled exception
@Hamayama commented on GitHub (Apr 12, 2021): I set up VS2019 and checked the call stack. - vim aiueo_unicode.txt → resize ``` src/buffer/out/textBuffer.cpp TextBuffer::Reflow ↓ newBuffer.InsertCharacter ↓ _PrepareForDoubleByteSequence ↓ _AssertValidDoubleByteSequence // N, T failing case (uncorrectable) or // L, N and L, L failing cases (correctable) or // T, T failing case (uncorrectable) return false; ↓ _PrepareForDoubleByteSequence FAIL_FAST_IF → Unhandled exception ```
Author
Owner

@Hamayama commented on GitHub (Apr 12, 2021):

I made a quick fix.

diff -u -r src_orig/buffer/out/textBuffer.cpp src/buffer/out/textBuffer.cpp
--- src_orig/buffer/out/textBuffer.cpp	2021-04-11 20:24:10.253074800 +0900
+++ src/buffer/out/textBuffer.cpp	2021-04-12 22:05:31.059636600 +0900
@@ -2192,6 +2192,12 @@
                 const auto dbcsAttr = row.GetCharRow().DbcsAttrAt(iOldCol);
                 const auto textAttr = row.GetAttrRow().GetAttrByColumn(iOldCol);
 
+                // workaround for https://github.com/microsoft/terminal/issues/9547
+                if (!newBuffer._AssertValidDoubleByteSequence(dbcsAttr))
+                {
+                    break;
+                }
+
                 if (!newBuffer.InsertCharacter(glyph, dbcsAttr, textAttr))
                 {
                     hr = E_OUTOFMEMORY;

There seems to be multiple error handling methods.

  1. hr = E_OUTOFMEMORY; break;
  2. CATCH_RETURN();
  3. FAIL_FAST_IF();

But, no method seems to be useful for this issue ...

@Hamayama commented on GitHub (Apr 12, 2021): I made a quick fix. ``` diff -u -r src_orig/buffer/out/textBuffer.cpp src/buffer/out/textBuffer.cpp --- src_orig/buffer/out/textBuffer.cpp 2021-04-11 20:24:10.253074800 +0900 +++ src/buffer/out/textBuffer.cpp 2021-04-12 22:05:31.059636600 +0900 @@ -2192,6 +2192,12 @@ const auto dbcsAttr = row.GetCharRow().DbcsAttrAt(iOldCol); const auto textAttr = row.GetAttrRow().GetAttrByColumn(iOldCol); + // workaround for https://github.com/microsoft/terminal/issues/9547 + if (!newBuffer._AssertValidDoubleByteSequence(dbcsAttr)) + { + break; + } + if (!newBuffer.InsertCharacter(glyph, dbcsAttr, textAttr)) { hr = E_OUTOFMEMORY; ``` There seems to be multiple error handling methods. 1. hr = E_OUTOFMEMORY; break; 2. CATCH_RETURN(); 3. FAIL_FAST_IF(); But, no method seems to be useful for this issue ...
Author
Owner

@DHowett commented on GitHub (Apr 13, 2021):

Sorry -- we actually have a fix for this one coming back in from the Windows OS code. I haven't merged it into this repository yet!

@DHowett commented on GitHub (Apr 13, 2021): Sorry -- we actually have a fix for this one coming back in from the Windows OS code. I haven't merged it into this repository yet!
Author
Owner

@DHowett commented on GitHub (Apr 13, 2021):

Thanks for the reminder, though -- i need to do that before we ship 1.7 (!)

@DHowett commented on GitHub (Apr 13, 2021): Thanks for the reminder, though -- i need to do that before we ship 1.7 (!)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#13095