devpod icon indicating copy to clipboard operation
devpod copied to clipboard

ssh terminal rendering issues

Open mukerjee opened this issue 1 year ago • 1 comments

What happened?

When using the local docker provider, ssh to the workspace can cause terminal rending when the screen is refreshed.

For example, if you ssh in and start tmux and hit a few times to make a few lines and then create a new tmux pane to the right, the left terminal rendering starts to get messed up. If you then open something that refreshes the screen often (like htop) in both the left and right pane, you will see a lot of funky rendering (i.e., data from the right pane shows up in the left pane and vice-versa).

I'm seeing very similar issues to these other project issues: https://github.com/microsoft/terminal/issues/6987 --> has a nice gif in the first post https://github.com/tmux/tmux/issues/224

The issue seems to happen even without tmux, as long as you use some terminal software that renders panes on the screen e.g., vim, emacs, etc. with split left and right panes.

This issue happens in both iTerm2 and macos terminal applications.

This issue does not happen if you just docker exec -it ... bash into the container.

This kind of scrambling of the terminal effectively makes ssh based use of a workspace (e.g., for development work using cli editors like vim / emacs / ...) unusable.

I am currently working around this issue by following the advice in the threads I linked above; if you add:

set -ag terminal-overrides ',*:cud1=\E[1B'

to your ~/.tmux.conf it resolves the issue.

From some reading on those threads, it sounds like the issue has something to do with improper \r's (or \r\n's?) making it into situations where the terminal is expecting \n's.

I did some poking around the code to see if i could find where this might be happening but didn't see anything obvious.

What did you expect to happen instead?

ssh'ing into the a local workspace shouldn't cause rendering issues in the terminal

How can we reproduce the bug? (as minimally and precisely as possible)

  • Spin up a debian container using devpod
  • $ apt update
  • $ apt install tmux htop
  • $ tmux
  • hit enter a few times to create a few lines in the current pane
  • create a new pane on the right: Ctrl-B then %
  • notice how some of the lines in the left pane disappeared and that the tmux pane divider line isn't rendered correctly
  • try running htop in either pane, or both --> notice how its rendering gets strange over time

Local Environment:

  • DevPod Version: 0.53.0
  • Operating System: mac
  • ARCH of the OS: ARM64

DevPod Provider:

  • Local/remote provider: docker

Anything else we need to know?

I'm happy to dig into this if you can point me in the right direction

mukerjee avatar Feb 27 '24 16:02 mukerjee

Thanks @mukerjee for reporting

Can you see if a pty is correclty instantiated for the various processes?

You can start with running tty on the first shell you land (and maybe ls -la /dev/pts) then open tmux and repeat for each pane

89luca89 avatar Feb 28 '24 15:02 89luca89

Closing due to inactivity, feel free to reopen if the problem is persisting

89luca89 avatar May 02 '24 12:05 89luca89