SSH from bash can freeze the console when non regular characters are outputed. #56

Closed
opened 2026-01-30 21:40:47 +00:00 by claunia · 11 comments
Owner

Originally created by @MarcMagnin on GitHub (Jan 25, 2018).

Hi!

  • Your Windows build number:
    Microsoft Windows [Version 10.0.16299.192]

  • What you're doing and what's happening:
    Run an Ubuntu VM (mine is v16) with Golang 1.9.3 installed on it (with Virtualbox for instance).
    SSH from Windows bash onto that VM and run the following golang program:

package main

import (
	"math"
	"fmt"
)

func main() {

	var tt float32 = 1
	for j := 0; j < 5000; j++ {
		bits := uint64(math.Float32bits(tt))
		tt++
		byteCount := 4
		var bb []byte
		bb = make([]byte, 0, byteCount)
		for i := 0; i < byteCount; i++ {
			bb = append(bb, byte(bits&255))
			bits = bits >> 8
		}
		fmt.Print(string(bb))
	}
}

go run <filename>.go

  • What's wrong / what should be happening instead:
    It starts outputing some characters and then freeze.
    Characters outputed:
  ?   @  @@  @  @  @  @   A  A   A  0A  @A  PA  `A  pA  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A   B  B B  B  B  B  B  B   B  $B  (B  ,
B  0B  4B  8B  <B  @B  DB  HB  LB  PB  TB  XB  \B  `B  dB  hB  lB  pB  tB  xB  |B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B
B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B   C  C  C  C  C  
C  C C          C
C  C  C  C  C  C  C  C  C  C  C  C  C  C     C  C  C  C   C  !C  "C  #C  $C  %C  &C  'C  (C  )C  *C  +C  ,C  -C  .C  /C  0C  1C  2
3C  4C  5C  6C  7C  8C  9C  :C  ;C  <C  =C  >C  ?C  @C  AC  BC  CC  DC  EC  FC  GC  HC  IC  JC  KC  LC  MC  NC  OC  PC  QC  RC  SC  TC  UC  VC  WC
XC  YC  ZC  [C  \C  ]C  ^C  _C  `C  aC  bC  cC  dC  eC  fC  gC  hC  iC  jC  kC  lC  mC  nC  oC  pC  qC  rC  sC  tC  uC  vC  wC  xC  yC  zC  {C  |C
}C  ~C  C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C
C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C
C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C
C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C
C C  C C  C C  C C  C C  C C  C C  C C  C C  C C  C C   D @ D  D  D  D @D D D  D @D D D  D @D D D  D @D D D  D @D D D  D @D 
D  D @D D D D DDD       D @     D       D       D
D @
D
D
D  D @D D D  D @D D D  D @D D D  D @D D D  D @D D D  D @D D D  D @D D D  D @D D D  D @D D D  D @D D D  D @
D D D  D @D D D  D @D D D    D @D D D  D @D D D  D @D D D  D @D D D   D @ D  D  D  !D @!D !D !D  "D @"D "D "D  #D @#D #D #
D  $D @$D $D $D  %D @%D %D %D  &D @&D &D &D  'D @'D 'D 'D  (D @(D (D (D  )D @)D )D )D  *D @*D *D *D  +D @+D +D +D  ,D @,D ,D ,D  -D @-D -D -D  .D @.
D .D .D  /D @/D /D /D  0D @0D 0D 0D  1D @1D 1D 1D  2D @2D 2D 2D  3D @3D 3D 3D  4D @4D 4D 4D  5D @5D 5D 5D  6D @6D 6D 6D  7D @7D 7D 7D  8D @8D 8D 8D
9D @9D 9D 9D  :D @:D :D :D  ;D @;D ;D ;D  <D @<D <D <D  =D @=D =D =D  >D @>D >D >D  ?D @?D ?D ?D  @D @@D @D @D  AD @AD AD AD  BD @BD BD BD  CD @CD C
D CD  DD @DD DD DD  ED @ED ED ED  FD @FD FD FD  GD @GD GD GD  HD @HD HD HD  ID @ID ID ID  JD @JD JD JD  KD @KD KD KD  LD @LD LD LD  MD @MD MD MD  N
@ND ND ND  OD @OD OD OD  PD @PD PD PD  QD @QD QD QD  RD @RD RD RD  SD @SD SD SD  TD @TD TD TD  UD @UD UD UD  VD @VD VD VD  WD @WD WD WD  XD @XD XD X
D  YD @YD YD YD  ZD @ZD ZD ZD  [D @[D [D [D  \D @\D \D \D  ]D @]D ]D ]D  ^D @^D ^D ^D  _D @_D _D _D  `D @`D `D `D  aD @aD aD aD  bD @bD bD bD  cD @c
D cD cD  dD @dD dD dD  eD @eD eD eD  fD @fD fD fD  gD @gD gD gD  hD @hD hD hD  iD @iD iD iD  jD @jD jD jD  kD @kD kD kD  lD @lD lD lD  mD @mD mD mD
nD @nD nD nD  oD @oD oD oD  pD @pD pD pD  qD @qD qD qD  rD @rD rD rD  sD @sD sD sD  tD @tD tD tD  uD @uD uD uD  vD @vD vD vD  wD @wD wD wD  xD @xD x
D xD  yD @yD yD yD  zD @zD zD zD  {D @{D {D {D  |D @|D |D |D  }D @}D }D }D  ~D @~D ~D ~D  D @D D

This works perfectly fine on powershell (running the program from Windows) or within the Ubuntu native terminal (from Virtualbox interface).

Regards

Originally created by @MarcMagnin on GitHub (Jan 25, 2018). Hi! * Your Windows build number: Microsoft Windows [Version 10.0.16299.192] * What you're doing and what's happening: Run an Ubuntu VM (mine is v16) with Golang 1.9.3 installed on it (with Virtualbox for instance). SSH from Windows bash onto that VM and run the following golang program: ``` package main import ( "math" "fmt" ) func main() { var tt float32 = 1 for j := 0; j < 5000; j++ { bits := uint64(math.Float32bits(tt)) tt++ byteCount := 4 var bb []byte bb = make([]byte, 0, byteCount) for i := 0; i < byteCount; i++ { bb = append(bb, byte(bits&255)) bits = bits >> 8 } fmt.Print(string(bb)) } } ``` `go run <filename>.go` * What's wrong / what should be happening instead: It starts outputing some characters and then freeze. Characters outputed: ``` ? @ @@ @ @ @ @ A A A 0A @A PA `A pA A A A A A A A A A A A A A A A A B B B B B B B B B $B (B , B 0B 4B 8B <B @B DB HB LB PB TB XB \B `B dB hB lB pB tB xB |B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B C C C C C  C C C C C C C C C C C C C C C C C C C C C C C !C "C #C $C %C &C 'C (C )C *C +C ,C -C .C /C 0C 1C 2 3C 4C 5C 6C 7C 8C 9C :C ;C <C =C >C ?C @C AC BC CC DC EC FC GC HC IC JC KC LC MC NC OC PC QC RC SC TC UC VC WC XC YC ZC [C \C ]C ^C _C `C aC bC cC dC eC fC gC hC iC jC kC lC mC nC oC pC qC rC sC tC uC vC wC xC yC zC {C |C }C ~C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C D @ D D D D @D D D D @D D D D @D D D D @D D D D @D D D D @D  D D @D D D D DDD D @ D D D D @ D D D D @D D D D @D D D D @D D D D @D D D D @D D D D @D D D D @D D D D @D D D D @D D D D @D D D D @ D D D D @D D D D @D D D D @D D D D @D D D D @D D D D @D D D D @ D D D !D @!D !D !D "D @"D "D "D #D @#D #D # D $D @$D $D $D %D @%D %D %D &D @&D &D &D 'D @'D 'D 'D (D @(D (D (D )D @)D )D )D *D @*D *D *D +D @+D +D +D ,D @,D ,D ,D -D @-D -D -D .D @. D .D .D /D @/D /D /D 0D @0D 0D 0D 1D @1D 1D 1D 2D @2D 2D 2D 3D @3D 3D 3D 4D @4D 4D 4D 5D @5D 5D 5D 6D @6D 6D 6D 7D @7D 7D 7D 8D @8D 8D 8D 9D @9D 9D 9D :D @:D :D :D ;D @;D ;D ;D <D @<D <D <D =D @=D =D =D >D @>D >D >D ?D @?D ?D ?D @D @@D @D @D AD @AD AD AD BD @BD BD BD CD @CD C D CD DD @DD DD DD ED @ED ED ED FD @FD FD FD GD @GD GD GD HD @HD HD HD ID @ID ID ID JD @JD JD JD KD @KD KD KD LD @LD LD LD MD @MD MD MD N @ND ND ND OD @OD OD OD PD @PD PD PD QD @QD QD QD RD @RD RD RD SD @SD SD SD TD @TD TD TD UD @UD UD UD VD @VD VD VD WD @WD WD WD XD @XD XD X D YD @YD YD YD ZD @ZD ZD ZD [D @[D [D [D \D @\D \D \D ]D @]D ]D ]D ^D @^D ^D ^D _D @_D _D _D `D @`D `D `D aD @aD aD aD bD @bD bD bD cD @c D cD cD dD @dD dD dD eD @eD eD eD fD @fD fD fD gD @gD gD gD hD @hD hD hD iD @iD iD iD jD @jD jD jD kD @kD kD kD lD @lD lD lD mD @mD mD mD nD @nD nD nD oD @oD oD oD pD @pD pD pD qD @qD qD qD rD @rD rD rD sD @sD sD sD tD @tD tD tD uD @uD uD uD vD @vD vD vD wD @wD wD wD xD @xD x D xD yD @yD yD yD zD @zD zD zD {D @{D {D {D |D @|D |D |D }D @}D }D }D ~D @~D ~D ~D D @D D ``` This works perfectly fine on powershell (running the program from Windows) or within the Ubuntu native terminal (from Virtualbox interface). Regards
Author
Owner

@zadjii-msft commented on GitHub (Feb 1, 2018):

Does this work if you take SSH out of the equation?

What happens when you run the above go script directly in WSL?

If this works in powershell (running Go on Windows), but not in bash (running Go on WSL), then I'd be inclined to believe this is a WSL bug, not a console issue.

@zadjii-msft commented on GitHub (Feb 1, 2018): Does this work if you take SSH out of the equation? What happens when you run the above go script directly in WSL? If this works in powershell (running Go on Windows), but not in bash (running Go on WSL), then I'd be inclined to believe this is a WSL bug, not a console issue.
Author
Owner

@MarcMagnin commented on GitHub (Feb 1, 2018):

Yes this works fine everywhere without SSH.

@MarcMagnin commented on GitHub (Feb 1, 2018): Yes this works fine everywhere without SSH.
Author
Owner

@miniksa commented on GitHub (May 29, 2019):

This has been a long time, so we should probably try to re-repro this.

@miniksa commented on GitHub (May 29, 2019): This has been a long time, so we should probably try to re-repro this.
Author
Owner

@SvenBrunk commented on GitHub (Jul 14, 2021):

I might be facing the same issue. For me the Windows Terminal freezes when I type "ls -l" on a RHEL server that outputs links as "->".
At least that is my working theory. I first thought it might be an SSH bug related to certain ACLs, but with kitty (putty clone) I can view the directories just fine.
Might of course also be the colors:
image
or one of these permission issues:
lsattr: Permission denied While reading flags on ./config.inc.php
lsattr: Operation not supported While reading flags on ./export

@SvenBrunk commented on GitHub (Jul 14, 2021): I might be facing the same issue. For me the Windows Terminal freezes when I type "ls -l" on a RHEL server that outputs links as "->". At least that is my working theory. I first thought it might be an SSH bug related to certain ACLs, but with kitty (putty clone) I can view the directories just fine. Might of course also be the colors: ![image](https://user-images.githubusercontent.com/4963144/125598007-73e4d073-9b9a-47d2-ba79-91875c44c8c5.png) or one of these permission issues: lsattr: Permission denied While reading flags on ./config.inc.php lsattr: Operation not supported While reading flags on ./export
Author
Owner

@zadjii-msft commented on GitHub (Jul 14, 2021):

I'm honestly kind of shocked that this 3 year old issue is still open without any traction. If this was more widespread, I'm sure we would have seen more hits...

@SvenBrunk What Terminal version are you using, what ssh are you using? Could you get a debug tap trace of the terminal when it freezes? That could help ID the string of text that triggers this.

@zadjii-msft commented on GitHub (Jul 14, 2021): I'm honestly kind of shocked that this 3 year old issue is still open without any traction. If this was more widespread, I'm sure we would have seen more hits... @SvenBrunk What Terminal version are you using, what `ssh` are you using? Could you get a [debug tap](https://github.com/microsoft/terminal/wiki/Enabling-the-debug-tap) trace of the terminal when it freezes? That could help ID the string of text that triggers this.
Author
Owner

@miniksa commented on GitHub (Jul 15, 2021):

You could also attempt to tee the output to a file and attach it so we can reproduce it hopefully at-will with a cat.

I also wonder if #10653 will help this. Perhaps its the display that's freezing up and @lhecker's ticket lock will help.

@miniksa commented on GitHub (Jul 15, 2021): You could also attempt to `tee` the output to a file and attach it so we can reproduce it hopefully at-will with a `cat`. I also wonder if #10653 will help this. Perhaps its the display that's freezing up and @lhecker's ticket lock will help.
Author
Owner

@SvenBrunk commented on GitHub (Jul 20, 2021):

I am using
Windows Terminal
Version: 1.8.1521.0

SSH: OpenSSH_8.2p1 Ubuntu-4ubuntu0.2, OpenSSL 1.1.1f 31 Mar 2020

Unfortunately when I tried today from the office it didn't happen. I will try again when I am in Homeoffice today. Maybe there is an issue in conjunction to the VPN connection. 🤔
Which would also explain that not many people face that issue.
(Well... or someone messed up the server configuration and now cleaned it up silently)

@SvenBrunk commented on GitHub (Jul 20, 2021): I am using Windows Terminal Version: 1.8.1521.0 SSH: OpenSSH_8.2p1 Ubuntu-4ubuntu0.2, OpenSSL 1.1.1f 31 Mar 2020 Unfortunately when I tried today from the office it didn't happen. I will try again when I am in Homeoffice today. Maybe there is an issue in conjunction to the VPN connection. 🤔 Which would also explain that not many people face that issue. (Well... or someone messed up the server configuration and now cleaned it up silently)
Author
Owner

@zadjii-msft commented on GitHub (Jul 20, 2021):

tbh, given the way OP responded

Yes this works fine everywhere without SSH.

then this should have probably been moved to https://github.com/PowerShell/Win32-OpenSSH/ a long time ago 😕

@zadjii-msft commented on GitHub (Jul 20, 2021): tbh, given the way OP responded > Yes this works fine everywhere without SSH. then this should have probably been moved to https://github.com/PowerShell/Win32-OpenSSH/ a long time ago 😕
Author
Owner

@SvenBrunk commented on GitHub (Jul 23, 2021):

It IS connected to the VPN-connection. In Homeoffice the connection stalls.
Unfortunately the output in the debug tap is completely none:
$␛[1Cllss␣␣--llaa␍␍␊␍
(I pressed return again... )

@SvenBrunk commented on GitHub (Jul 23, 2021): It IS connected to the VPN-connection. In Homeoffice the connection stalls. Unfortunately the output in the debug tap is completely none: $␛[1Cllss␣␣--llaa␍␍␊␍ (I pressed return again... )
Author
Owner

@DHowett commented on GitHub (Jul 23, 2021):

As a test... when the connection stalls, can you press Enter ~ .? What happens?

@DHowett commented on GitHub (Jul 23, 2021): As a test... when the connection stalls, can you press <kbd>Enter</kbd> <kbd>~</kbd> <kbd>.</kbd>? What happens?
Author
Owner

@ghost commented on GitHub (Jul 27, 2021):

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 (Jul 27, 2021): 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**.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#56