contour-terminal / contour

Modern C++ Terminal Emulator
http://contour-terminal.org/
Apache License 2.0
2.31k stars 100 forks source link

crash using ssh on Windows #1470

Open ferdinandyb opened 4 months ago

ferdinandyb commented 4 months ago

Contour Terminal version

Contour Terminal Emulator 0.4.3.6442

Installer source

Github: source code cloned

Operating System

Windows

Architecture

x86-64

Other Software

No response

Steps to reproduce

I'm using tmux and vim most of the time, so it's really hard to tell if it happens with these or if it would happen with something else as well, but I'm using the ssh profile feature to connect to my local WSL. After a while input hangs and then it crashes.

Expected Behavior

No response

Actual Behavior

Here's the end of --debug all:

[2024-02-13 12:10:54.1568968.156896] [vt.trace.sequence] Processing SGR            CSI 48;5;236 m
[2024-02-13 12:10:54.1569555.156955] [vt.trace.sequence] text: "   "
[2024-02-13 12:10:54.1569975.156997] [vt.trace.sequence] Processing CUP            CSI 7;5 H
[2024-02-13 12:10:54.1570537.157053] [vt.trace.sequence] Processing DECRM          CSI ? 12 l
[2024-02-13 12:10:54.1571320.157132] [vt.trace.sequence] Processing DECSM          CSI ? 25 h
[2024-02-13 12:10:54.1572003.157200] [vt.trace.sequence] Processing SCS_G0_USASCII ESC ( B
[2024-02-13 12:10:54.1572593.157259] [vt.trace.sequence] Processing SGR            CSI m
[2024-02-13 12:10:54.1573053.157305] [vt.trace.sequence] Processing DECSM          CSI ? 2026 h
[2024-02-13 12:10:54.1573844.157368] [vt.trace.sequence] Processing DECRM          CSI ? 25 l
[2024-02-13 12:10:54.1574905.157490] [vt.trace.sequence] Processing SGR            CSI 38;5;84 m
[2024-02-13 12:10:54.1575684.157568] [vt.trace.sequence] Processing SGR            CSI 48;5;236 m
[2024-02-13 12:10:54.1576379.157637] [vt.trace.sequence] Processing CUP            CSI H
[2024-02-13 12:10:54.1576917.157691] [vt.trace.sequence] text: " 1: l/columnspecs.py+  "
[2024-02-13 12:10:54.1577817.157781] [vt.trace.sequence] Processing SGR            CSI 38;5;236 m
[2024-02-13 12:10:54.1578542.157854] [vt.trace.sequence] Processing SGR            CSI 48;5;239 m
[2024-02-13 12:10:54.1579196.157919] [vt.trace.sequence] text: ""
[2024-02-13 12:10:54.1579654.157965] [vt.trace.sequence] Processing SGR            CSI 38;5;253 m
[2024-02-13 12:10:54.1580595.158059] [vt.trace.sequence] text: " 5: spark_runner.py  ..."
[2024-02-13 12:10:54.1581729.158172] [vt.trace.sequence] Processing SGR            CSI 38;5;239 m
[2024-02-13 12:10:54.1582699.158269] [vt.trace.sequence] Processing SGR            CSI 48;5;237 m
[2024-02-13 12:10:54.1583804.158380] [vt.trace.sequence] text: ""
[2024-02-13 12:10:54.1584750.158474] [vt.trace.sequence] Processing SGR            CSI 38;5;236 m
[2024-02-13 12:10:54.1585646.158564] [vt.trace.sequence] text: "                       "
[2024-02-13 12:10:54.1586224.158622] [vt.trace.sequence] Processing SGR            CSI 38;5;237 m
[2024-02-13 12:10:54.1586892.158689] [vt.trace.sequence] text: ""
[2024-02-13 12:10:54.1587438.158743] [vt.trace.sequence] Processing SGR            CSI 38;5;61 m
[2024-02-13 12:10:54.1588167.158816] [gui.input] Key Release event received:  UpArrow
[2024-02-13 12:10:54.1621123.162112] [vt.trace.sequence] text: ""
[2024-02-13 12:10:54.1622055.162205] [gui.input] Key Repeat event received:  UpArrow
[2024-02-13 12:10:54.1622342.162234] [vt.trace.sequence] Processing SGR            CSI 38;5;253 m
[2024-02-13 12:10:54.1622761.162276] [vt.input] Sending  "UpArrow" Repeat.
[error] Failed to read from SSH channel. Decrypt failed

Additional notes

No response

ferdinandyb commented 4 months ago

I'm just going to add a different example, maybe you can see a pattern:

[2024-02-13 12:47:31.3948360.394835] [vt.trace.sequence] Processing SGR            CSI 36 m
[2024-02-13 12:47:31.3948941.394894] [vt.trace.sequence] text: "2024-01-10 "
[2024-02-13 12:47:31.3949478.394947] [vt.trace.sequence] Processing SCS_G0_USASCII ESC ( B
[2024-02-13 12:47:31.3950042.395004] [vt.trace.sequence] Processing SGR            CSI m
[2024-02-13 12:47:31.3950575.395057] [vt.trace.sequence] Processing SGR            CSI 35 m
[2024-02-13 12:47:31.3951272.395127] [vt.trace.sequence] text: "Bence Ferdin.."
[2024-02-13 12:47:31.3951873.395187] [vt.trace.sequence] Processing SCS_G0_USASCII ESC ( B
[2024-02-13 12:47:31.3952282.395228] [vt.trace.sequence] Processing SGR            CSI m
[2024-02-13 12:47:31.3952717.395271] [vt.trace.sequence] text: " eval: add new dataset and refactor p-r-table"
[2024-02-13 12:47:31.3953253.395325] [vt.trace.sequence] Processing SGR            CSI 36 m
[2024-02-13 12:47:31.3953920.395392] [vt.trace.sequence] text: " "
[2024-02-13 12:47:31.3954358.395435] [vt.trace.sequence] Processing SCS_G0_USASCII ESC ( B
[2024-02-13 12:47:31.3954781.395478] [vt.trace.sequence] Processing SGR            CSI m
[2024-02-13 12:47:31.3955199.395519] [vt.trace.sequence] Processing EL             CSI K
[2024-02-13 12:47:31.3955890.395589] [vt.input] Sending mouse release Left  at (46, 14).
[error] Failed to read from SSH channel. Decrypt failed
ferdinandyb commented 4 months ago

Hmm, I'm also doing double ssh right now (contour -> ssh into WSL -> ssh to remote machine -> tmux -> vim) so maybe it could also be related to that.

ferdinandyb commented 4 months ago

If I don't use the contour ssh profile, but just open WSL via powershell as "normal" and then ssh away to the remote machine, then contour doesn't crash, but can hang for a bit. The input still seems to be received since after the freeze resolves itself actions done after the freeze are carried out (i.e. clicking on a tmux pane switches). I was again working in tmux, with vim and ipython on the remote. This freeze does not happen in Wezterm, so there's definitely something going on with contour.

ferdinandyb commented 4 months ago

So this is probably actually three things:

ferdinandyb commented 4 months ago

I had a crash recently when using the ssh feature and opening tmux. It hung without actually opening the tmux window, so just displaying the prompt with tmux typed. I have a feeling that what is going on is that for some reason tmux in contour (maybe only over ssh?) freezes, and if you're using the ssh feature of contour, then that triggers this decrypt failed error.

tldr; the quickest usability fix would be for the ssh feature to be more resilient, or try a reconnect, something like that.

ferdinandyb commented 4 months ago

Windows PowerShell.txt

The above is a Windows powershell dump, where I ran contour.exe --profile wsl --debug all (sorry guys, I find the non-dashed versions of the parameters unreadable), it doesnt have everything I'm afraid, but what I did was:

sudo apt update
sudo apt dist-upgrade
tmux

and again, did right when opening tmux.

ferdinandyb commented 4 months ago

Here's another one, where I attached, detached and attached to tmux again: Windows PowerShell.txt

ferdinandyb commented 4 months ago

I'm now pretty sure that using contour "normally" (i.e. not via ssh, but in WSL), tmux/vim combo works as expected, so no crash and I don't even see any freezes.

ferdinandyb commented 4 months ago

I managed to crash ssh-contour with vim inside aerc, so it's not only tmux.