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

Crash in Windows Terminal TerminalControl!TextBuffer::Reflow #4907

Closed
Treit opened this issue Mar 13, 2020 · 11 comments
Closed

Crash in Windows Terminal TerminalControl!TextBuffer::Reflow #4907

Treit opened this issue Mar 13, 2020 · 11 comments
Assignees
Labels
Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Priority-3 A description (P3) Product-Terminal The new Windows Terminal. Severity-Crash Crashes are real bad news.
Milestone

Comments

@Treit
Copy link

Treit commented Mar 13, 2020

While running a stress test on Windows Terminal version 0.10.721.0, I was able to cause a crash in TerminalControl!TextBuffer::Reflow.

I was running https://github.com/Treit/TerminalStress, the application I wrote some time back to reproduce a different bug (that was since fixed.)

I was running something like 5 instances in parallel in different panes on the same tab, then rapidly pressing Alt+Enter to switch from full screen to normal and back.

WindowsTerminal11.txt

I have attached some additional output from the debugger that might be helpful.

@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 Mar 13, 2020
@zadjii-msft zadjii-msft added Issue-Bug It either shouldn't be doing this or needs an investigation. Severity-Crash Crashes are real bad news. Product-Terminal The new Windows Terminal. labels Mar 13, 2020
@DHowett-MSFT DHowett-MSFT added the Priority-3 A description (P3) label Mar 18, 2020
@DHowett-MSFT
Copy link
Contributor

DHowett-MSFT commented Mar 18, 2020

Finger-in-the-air guess is P3: if this only reproduces when you're murdering your terminal by resizing it multiple times a second while printing megabytes of output, I'm going to say it won't strike too many people too often.

It's still worth fixing.

@DHowett-MSFT DHowett-MSFT removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Mar 18, 2020
@DHowett-MSFT DHowett-MSFT added this to the Terminal v1.x milestone Mar 18, 2020
@DHowett-MSFT
Copy link
Contributor

I can't repro this on v0.11.1212, even resizing like mad with five open panes printing our 6MB test file simultaneously.

I'm gonna call this one no-repro. @Treit please let me know if you can still repro!

@DHowett-MSFT DHowett-MSFT added the Resolution-No-Repro We couldn't get this to happen, or it stopped happening entirely. label May 4, 2020
@Treit
Copy link
Author

Treit commented May 4, 2020

I can't repro this on v0.11.1212, even resizing like mad with five open panes printing our 6MB test file simultaneously.

I'm gonna call this one no-repro. @Treit please let me know if you can still repro!

@DHowett-MSFT Yes I can still reproduce it on 0.11.1212.0

@Treit
Copy link
Author

Treit commented May 4, 2020

@DHowett-MSFT here is a brief video I just made demonstrating how I reproduced the issue on 0.11.1212.0:
https://1drv.ms/v/s!Alav93a0o3vchOwF91dG-jJ5He1g0w?e=2Lm59k

@DHowett-MSFT
Copy link
Contributor

Perfect. Thank you.

@DHowett-MSFT DHowett-MSFT reopened this May 5, 2020
@DHowett-MSFT DHowett-MSFT removed the Resolution-No-Repro We couldn't get this to happen, or it stopped happening entirely. label May 5, 2020
@DHowett-MSFT
Copy link
Contributor

The problem is, as always, double-width characters. Somehow, the source buffer (during the reflow operation) is getting a hanging DBCS Trailing character that we dutifully try to reflect into the new buffer.

@kasper93
Copy link
Contributor

kasper93 commented May 16, 2020

Would you share some of the glyphs that are in your powerlevel10k theme?

In fact it is powerleve9k, default setup nothing fancy.

I'll mark this as a /dup of #4907 in the meantime -- same call stack, same symptoms, same repro (go wild on resizing with garb in the buffer)

@DHowett-MSFT Since the other issue has been closed I replying here.

For me the problems started with 7ae3433 probably because ✔ has been made wide.

To summarize my problems:

  1. tmux drawing is broken. I needed to select pane to redraw vertical separator. Tick mark draw over separator. Also when resizing it glitches visually. https://streamable.com/xwrs5z
  2. WT crashes https://streamable.com/xwrs5z It is very easy to reproduce in tmux, I did reproduce it also without, but it is harder. (watch after 27s, before I tried not to crash it, also I cut video before window closed, but it crashed in the end, you can see it is not responding anymore)
  3. Changing this tick mark to wide (or smth else) made it mess up really bad when resizing. After 7ae3433: https://streamable.com/2wanng and before 7ae3433: https://streamable.com/rd2a8v

I initially though that crashes and other issues are related, but while they are introduced by the same commit for me, it looks like they are separate problems. We might reopen my issue for drawing problems and discuss crash in this one.

@DHowett
Copy link
Member

DHowett commented May 21, 2020

So @kasper93, we fixed the width of ✔ at least! This bug'll remain to track the resizing issue 😄

@DHowett
Copy link
Member

DHowett commented Apr 7, 2021

Fixing as part of MSFT-17364373, which is a conhost crash that hits moderately often (~500 hits in the past 14 days!)

@DHowett DHowett self-assigned this Apr 7, 2021
@ghost ghost added the Needs-Tag-Fix Doesn't match tag requirements label Apr 13, 2021
DHowett added a commit that referenced this issue Apr 13, 2021
…rately high-hitting Watsons

This commit fixes two issues:

1. We were pushing ConsoleWaitBlocks into the wait queue before they
   were fully constructed. This resulted in the wait being called before
   it even had an API message in it. [MSFT-24113101]
2. Drawing DBCS characters and resizing (a lot) would cause a crash
   because of an invalid DBCS cell state. This hits in both Terminal and
   conhost. [MSFT-17364373] [GH-4907]

The DBCS state check was promoted from an NT_ASSERT (which never fired
in release) to a FAIL_FAST in !1794053. The console kept chugging along
without failing in fre for all those years.

Fixes MSFT-24113101
Fixes MSFT-17364373
Fixes GH-4907 Retrieved from https://microsoft.visualstudio.com os.2020 OS official/rs_wdx_dxp_windev 108e746630749aa7851dd813b19e013ae31ef0db

(cherry picked from commit 8e7a866)
@ghost
Copy link

ghost commented Apr 14, 2021

🎉Windows Terminal v1.7.1033.0 has been released which incorporates this pull request.:tada:

Handy links:

@ghost
Copy link

ghost commented Apr 14, 2021

🎉Windows Terminal Preview v1.8.1032.0 has been released which incorporates this pull request.:tada:

Handy links:

mpela81 pushed a commit to mpela81/terminal that referenced this issue Apr 17, 2021
…rately high-hitting Watsons

This commit fixes two issues:

1. We were pushing ConsoleWaitBlocks into the wait queue before they
   were fully constructed. This resulted in the wait being called before
   it even had an API message in it. [MSFT-24113101]
2. Drawing DBCS characters and resizing (a lot) would cause a crash
   because of an invalid DBCS cell state. This hits in both Terminal and
   conhost. [MSFT-17364373] [microsoftGH-4907]

The DBCS state check was promoted from an NT_ASSERT (which never fired
in release) to a FAIL_FAST in !1794053. The console kept chugging along
without failing in fre for all those years.

Fixes MSFT-24113101
Fixes MSFT-17364373
Fixes microsoftGH-4907 Retrieved from https://microsoft.visualstudio.com os.2020 OS official/rs_wdx_dxp_windev 108e746630749aa7851dd813b19e013ae31ef0db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Priority-3 A description (P3) Product-Terminal The new Windows Terminal. Severity-Crash Crashes are real bad news.
Projects
None yet
Development

No branches or pull requests

5 participants