conpty exhibits pathological performance on scrolling region redraw (repaints entire screen) #9751

Closed
opened 2026-01-31 02:02:56 +00:00 by claunia · 18 comments
Owner

Originally created by @izghitu on GitHub (Jul 22, 2020).

Environment

Windows build number: Win32NT             10.0.18362.0 Microsoft Windows NT 10.0.18362.0
Windows Terminal version (if applicable): latest

Steps to reproduce

ssh into a remote host, execute a command that spits a lot of output

Expected behavior

In putty when the connection to a remote host is slow and a command spits a lot of output and that output comes back in frames(due to the slow connection) then I can just fine switch between SCREEN tabs. In windows terminal this is not possible. I am not even able to switch between tabs of the windows terminal until the command previous executed does not finish its output.

Actual behavior

Need to wait for full command output before I can do anything else in the windows terminal.

Originally created by @izghitu on GitHub (Jul 22, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 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 ``` Windows build number: Win32NT 10.0.18362.0 Microsoft Windows NT 10.0.18362.0 Windows Terminal version (if applicable): latest ``` # Steps to reproduce ssh into a remote host, execute a command that spits a lot of output # Expected behavior In putty when the connection to a remote host is slow and a command spits a lot of output and that output comes back in frames(due to the slow connection) then I can just fine switch between SCREEN tabs. In windows terminal this is not possible. I am not even able to switch between tabs of the windows terminal until the command previous executed does not finish its output. # Actual behavior Need to wait for full command output before I can do anything else in the windows terminal.
claunia added the Issue-BugNeeds-Tag-FixProduct-ConptyArea-PerformancePriority-2 labels 2026-01-31 02:02:57 +00:00
Author
Owner

@jblaine commented on GitHub (Aug 5, 2020):

@izghitu I believe your report is a duplicate of https://github.com/microsoft/terminal/issues/6258 which is specifically about Ctrl-C but I am sure that same situation applies to any control sequence, like those used in GNU screen.

@jblaine commented on GitHub (Aug 5, 2020): @izghitu I believe your report is a duplicate of https://github.com/microsoft/terminal/issues/6258 which is specifically about Ctrl-C but I am sure that same situation applies to any control sequence, like those used in GNU screen.
Author
Owner

@zadjii-msft commented on GitHub (Aug 5, 2020):

@izghitu Which ssh are you using? The ssh.exe that ships with Windows, or one from WSL (or some other one)? And which version?

Also latest doesn't really help as a version number, because at the time of your post, latest could have either meant 1.0, 1.1, or 1.2, depending if you were on the preview or release builds, and if you had gotten the release that shipped on the 22nd. Which WT version number exactly?

@jblaine this doesn't really sound like it's related to Ctrl+C to me at all. Here OP is just trying to switch tabs in screen, which isn't working (and is reasonable if the output is being heavily buffered), nor is switching Terminal tabs (which is really quite surprising)

@zadjii-msft commented on GitHub (Aug 5, 2020): @izghitu Which `ssh` are you using? The `ssh.exe` that ships with Windows, or one from WSL (or some other one)? And which version? Also `latest` doesn't really help as a version number, because at the time of your post, `latest` could have either meant 1.0, 1.1, or 1.2, depending if you were on the preview or release builds, and if you had gotten the release that shipped on the 22nd. Which WT version number exactly? @jblaine this doesn't _really_ sound like it's related to Ctrl+C to me at all. Here OP is just trying to switch tabs in `screen`, which isn't working (and is reasonable if the output is being heavily buffered), nor is switching Terminal tabs (which is really quite surprising)
Author
Owner

@izghitu commented on GitHub (Aug 5, 2020):

@zadjii-msft I use the ssh.exe that ships with WIndows. Its location is:

C:\\Windows\\System32\\OpenSSH\\ssh.exe

The version of the WT is Version: 1.1.2021.0

@izghitu commented on GitHub (Aug 5, 2020): @zadjii-msft I use the ssh.exe that ships with WIndows. Its location is: ``` C:\\Windows\\System32\\OpenSSH\\ssh.exe ``` The version of the WT is **Version: 1.1.2021.0**
Author
Owner

@zadjii-msft commented on GitHub (Aug 5, 2020):

Some other questions from #7191:

  • Does this repro without tmux/screen running on the remote host?
  • Does this repro with the ssh from a WSL distro?
  • More insane - if you run wsl.exe ssh.exe <args to ssh...> inside a legacy powershell/cmd window, does the same issue repro? This will cause wsl to create a conpty to host ssh.exe, which could help identify if the issue is conpty vs something else.
@zadjii-msft commented on GitHub (Aug 5, 2020): Some other questions from #7191: * Does this repro **without** `tmux`/`screen` running on the remote host? * Does this repro with the `ssh` from a WSL distro? * More insane - if you run `wsl.exe ssh.exe <args to ssh...>` inside a legacy powershell/cmd window, does the same issue repro? This will cause wsl to create a conpty to host `ssh.exe`, which could help identify if the issue is conpty vs something else.
Author
Owner

@jblaine commented on GitHub (Aug 5, 2020):

@zadjii-msft My hour of testing showed the following for what I'm experiencing.

Windows build number: Microsoft Windows [Version 10.0.18363.959]
Windows Terminal version (if applicable): 1.1.2021.0

Windows 10 native ssh client
Remote Linux host running either tmux or GNU screen, multiple versions all work to reproduce issue

Connect via Windows 10 ssh (under Terminal) to a remote host. At the remote host, run a new screen or tmux session OR re-attach to an existing one. Generate a lot of output from a shell in one of the screen or tmux windows. Terminal crawls in batches of text displayed and often becomes unresponsive for periods of time. In my particular case, I am using a Terminal profile with commandLine of "ssh <my args>"

The same behavior can be seen in a WSL distro using the distro's SSH connected to the remote host + attach to screen + cat big file.

It does not happen when running a bare CMD.EXE (outside of Terminal) and then wsl.exe ssh.exe <args to ssh...> + screen resume + cat big file.

After digging around in the open issues here and finding some other issue about slow rendering when colors are at play, I even tested when TERM=vt100 on the remote end and all coloring turned off. The performance issue still exists in that case, so it does not seem to have to do anything with that other color perf. issue.

@jblaine commented on GitHub (Aug 5, 2020): @zadjii-msft My hour of testing showed the following for what I'm experiencing. Windows build number: Microsoft Windows [Version 10.0.18363.959] Windows Terminal version (if applicable): 1.1.2021.0 Windows 10 native ssh client Remote Linux host running either tmux or GNU screen, multiple versions all work to reproduce issue Connect via Windows 10 ssh (under Terminal) to a remote host. At the remote host, run a new screen or tmux session OR re-attach to an existing one. Generate a lot of output from a shell in one of the screen or tmux windows. Terminal crawls in batches of text displayed and often becomes unresponsive for periods of time. In my particular case, I am using a Terminal profile with `commandLine` of `"ssh <my args>"` The same behavior can be seen in a WSL distro using the distro's SSH connected to the remote host + attach to screen + cat big file. It does **not** happen when running a bare CMD.EXE (outside of Terminal) and then `wsl.exe ssh.exe <args to ssh...>` + screen resume + cat big file. After digging around in the open issues here and finding some other issue about slow rendering when colors are at play, I even tested when TERM=vt100 on the remote end and all coloring turned off. The performance issue still exists in that case, so it does not seem to have to do anything with that other color perf. issue.
Author
Owner

@zadjii-msft commented on GitHub (Aug 5, 2020):

It does not happen when running a bare CMD.EXE (outside of Terminal) and then wsl.exe ssh.exe <args to ssh...> + screen resume + cat big file.

Well that pretty specifically rules out a whole bunch of possible sources of this issue actually. That narrows it down to specifically the Terminal, and rules out conpty, ssh.exe, and screen as possible sources of error.

That being said, I wonder what about the terminal is causing the stuttering. XAML? DX? Scrollbar updating?

Does setting "historySize":0 in your profile help at all? That'll disable scrollback, but might help narrow it down further.

There are also a pair of global renderer settings that might be able to help rule out DX. Does setting either of these to true in the global settings (outside of a profile) change anything?

  • experimental.rendering.forceFullRepaint
  • experimental.rendering.software
@zadjii-msft commented on GitHub (Aug 5, 2020): > It does **not** happen when running a bare CMD.EXE (outside of Terminal) and then `wsl.exe ssh.exe <args to ssh...>` + screen resume + cat big file. Well that pretty specifically rules out a whole bunch of possible sources of this issue actually. That narrows it down to _specifically_ the Terminal, and rules out conpty, `ssh.exe`, and `screen` as possible sources of error. That being said, I wonder what about the terminal is causing the stuttering. XAML? DX? Scrollbar updating? Does setting `"historySize":0` in your profile help at all? That'll disable scrollback, but might help narrow it down further. There are also a [pair of global renderer settings](https://docs.microsoft.com/en-us/windows/terminal/customize-settings/global-settings#rendering-settings) that might be able to help rule out DX. Does setting either of these to `true` in the global settings (outside of a profile) change anything? * `experimental.rendering.forceFullRepaint` * `experimental.rendering.software`
Author
Owner

@jblaine commented on GitHub (Aug 5, 2020):

No, none of those helped.

@jblaine commented on GitHub (Aug 5, 2020): No, none of those helped.
Author
Owner

@lucastheisen commented on GitHub (Aug 5, 2020):

Not sure how related this is to this exact issue, but output seems rather slow in general. I was working to confirm @jblaine 's findings and tried this quick benchmark from 3 different terminals: time bash -c "for i in {1..1000000}; do echo \$i; done;" It shows an order of magnitude slowdown for this terminal:

microsoft terminal:

real    2m53.944s
user    0m15.734s
sys     0m33.375s

wsltty:

real    0m25.828s
user    0m7.188s
sys     0m6.781s

mobaxterm:

real    0m29.078s
user    0m4.203s
sys     0m5.219s

But figured it might help narrow down a cause...

@lucastheisen commented on GitHub (Aug 5, 2020): Not sure how related this is to this _exact_ issue, but output seems rather slow in general. I was working to confirm @jblaine 's findings and tried this quick benchmark from 3 different terminals: `time bash -c "for i in {1..1000000}; do echo \$i; done;"` It shows an order of magnitude slowdown for this terminal: microsoft terminal: ```text real 2m53.944s user 0m15.734s sys 0m33.375s ``` wsltty: ```text real 0m25.828s user 0m7.188s sys 0m6.781s ``` mobaxterm: ```text real 0m29.078s user 0m4.203s sys 0m5.219s ``` But figured it might help narrow down a cause...
Author
Owner

@zadjii-msft commented on GitHub (Aug 5, 2020):

@lucastheisen That's actually something we're dealing with primarily over in #3075, but also in a bunch of different places. I'd keep an eye on that one 😉

@zadjii-msft commented on GitHub (Aug 5, 2020): @lucastheisen That's actually something we're dealing with primarily over in #3075, but also in a [bunch of different places](https://github.com/microsoft/terminal/issues?q=is%3Aissue+label%3AArea-Performance+is%3Aopen). I'd keep an eye on that one 😉
Author
Owner

@ghost commented on GitHub (Aug 9, 2020):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Aug 9, 2020): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Author
Owner

@jblaine commented on GitHub (Aug 13, 2020):

This should be reopened, please

@jblaine commented on GitHub (Aug 13, 2020): This should be reopened, please
Author
Owner

@DHowett commented on GitHub (Aug 13, 2020):

Thanks. Our bot should be taught to recognize any commenter who can provide additional information.

One more question - are you using a status line in screen or tmux?

@DHowett commented on GitHub (Aug 13, 2020): Thanks. Our bot should be taught to recognize any commenter who can provide additional information. One more question - are you using a status line in screen or tmux?
Author
Owner

@jblaine commented on GitHub (Aug 13, 2020):

Thanks @DHowett. Yes, I do use a statusline in screen. My tmux testing was only for this issue. I don't use tmux in my daily life.

@jblaine commented on GitHub (Aug 13, 2020): Thanks @DHowett. Yes, I do use a statusline in screen. My tmux testing was only for this issue. I don't use tmux in my daily life.
Author
Owner

@DHowett commented on GitHub (Aug 13, 2020):

Okay, excellent. Thanks.

We have a pathological redraw case when there are sub-full-screen scrolling regions active (like, where there’s a status line). We end up retransmitting the entire contents of the screen for every line between the backend and frontend processes in Terminal. The contention on the output queue bogs down the input queue.

@DHowett commented on GitHub (Aug 13, 2020): Okay, excellent. Thanks. We have a pathological redraw case when there are sub-full-screen scrolling regions active (like, where there’s a status line). We end up retransmitting the entire contents of the screen _for every line_ between the backend and frontend processes in Terminal. The contention on the output queue bogs down the input queue.
Author
Owner

@DHowett commented on GitHub (Aug 13, 2020):

I believe we have another version of this lying around somewhere, so I’ll assign myself to deduplicate.

@DHowett commented on GitHub (Aug 13, 2020): I believe we have another version of this lying around somewhere, so I’ll assign myself to deduplicate.
Author
Owner

@zadjii-msft commented on GitHub (Oct 23, 2020):

Just messaged Dustin about this - turns out there's not another dupe for this one! This is now the tracking thread for this issue. Thanks!

@zadjii-msft commented on GitHub (Oct 23, 2020): Just messaged Dustin about this - turns out there's _not_ another dupe for this one! _This is now the tracking thread for this issue_. Thanks!
Author
Owner

@zadjii-msft commented on GitHub (Jun 14, 2022):

Wait this might actually be #5228 after all. Or, at least, should be tracked as part of it. @DHowett back me up?

@zadjii-msft commented on GitHub (Jun 14, 2022): Wait this might actually be #5228 after all. Or, at least, should be tracked as part of it. @DHowett back me up?
Author
Owner

@zadjii-msft commented on GitHub (Sep 29, 2023):

I'm pretty sure this is /dup #%228 after all.

@zadjii-msft commented on GitHub (Sep 29, 2023): I'm pretty sure this is /dup #%228 after all.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9751