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

VSCode UI locks up occassionally when using "Powershell: Restart Current Session" #2377

Closed
JustinGrote opened this issue Dec 18, 2019 · 79 comments
Labels
Bug: VS Code Bugs in VS Code itself. Resolution-External Will close automatically.

Comments

@JustinGrote
Copy link
Collaborator

Issue Description

VSCode locks up on occasion when using powershell: restart session. It looks like it happens before the PSES loads. No debug was used in this attempt.

image

Attached Logs

Follow the instructions in the README about
capturing and sending logs.

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.19041
VSCode 1.42.0-insider
PowerShell Extension Version 2019.12.0

PowerShell Information

Name Value
PSVersion 5.1.19041.1
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.19041.1
BuildVersion 10.0.19041.1
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

##Issue Type: Performance Issue

Latest Powershell Preview: Use the command "Powershell: Restart Current Session". The freezing is intermittent but I have been able to reproduce on two separate computers now.

Extension version: 2019.12.0
VS Code version: Code - Insiders 1.42.0-insider (241d4048aabc31db0baed66bb3d58cf3210d981d, 2019-12-17T10:43:45.626Z)
OS version: Windows_NT x64 10.0.19041

System Info
Item Value
CPUs Intel(R) Core(TM) i5-1035G7 CPU @ 1.20GHz (8 x 1498)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: enabled
rasterization: enabled
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 7.60GB (1.49GB free)
Process Argv --folder-uri file:///c%3A/Users/jgrote/Projects/CredDriveGist/97fe1269f17d471191a08610fe71b956
Screen Reader no
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
    1	   116	 13408	code-insiders main
    0	   222	  9032	   window (Untitled-1 - 97fe1269f17d471191a08610fe71b956 - Visual Studio Code - Insiders)
    0	    15	  1520	     watcherService 
    0	    11	  6092	       console-window-host (Windows internal process)
    0	     6	 10580	     console-window-host (Windows internal process)
    0	   138	 10960	     C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "Import-Module 'c:\Users\jgrote\.vscode-insiders\extensions\ms-vscode.powershell-preview-2019.12.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2019.12.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\jgrote\.vscode-insiders\extensions\ms-vscode.powershell-preview-2019.12.0\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'c:\Users\jgrote\.vscode-insiders\extensions\ms-vscode.powershell-preview-2019.12.0\logs\1576688022-5d54cd62-c730-4487-bd08-747a9bd419e61576688019997\EditorServices.log' -SessionDetailsPath 'c:\Users\jgrote\.vscode-insiders\extensions\ms-vscode.powershell-preview-2019.12.0\sessions\PSES-VSCode-13408-997449' -FeatureFlags @() "
    0	    86	 10976	     pwsh.exe -nologo
    0	   135	 14120	     extensionHost
    0	    72	 14296	     searchService
    0	     6	 15512	     console-window-host (Windows internal process)
    0	    86	 10884	   window (Issue Reporter)
    0	     7	 12116	   C:\Users\jgrote\AppData\Local\Temp\vscode-update-user-x64\CodeSetup-insider-26f5dfcd76c9a02f116a706844611aeb09ae8c0b.exe /verysilent /update="C:\Users\jgrote\AppData\Local\Temp\vscode-update-user-x64\CodeSetup-insider-26f5dfcd76c9a02f116a706844611aeb09ae8c0b.flag" /nocloseapplications /mergetasks=runcode,!desktopicon,!quicklaunchicon
    0	    22	 12104	     "C:\Users\jgrote\AppData\Local\Temp\is-VT9TQ.tmp\CodeSetup-insider-26f5dfcd76c9a02f116a706844611aeb09ae8c0b.tmp" /SL5="$30662,58711380,168448,C:\Users\jgrote\AppData\Local\Temp\vscode-update-user-x64\CodeSetup-insider-26f5dfcd76c9a02f116a706844611aeb09ae8c0b.exe" /verysilent /update="C:\Users\jgrote\AppData\Local\Temp\vscode-update-user-x64\CodeSetup-insider-26f5dfcd76c9a02f116a706844611aeb09ae8c0b.flag" /nocloseapplications /mergetasks=runcode,!desktopicon,!quicklaunchicon
    2	   261	 14192	   gpu-process
    1	   178	 14760	   window (EditorServices.log - 1576688022-5d54cd62-c730-4487-bd08-747a9bd419e61576688019997 - Visual Studio Code - Insiders)
    0	    73	  9372	     searchService
    0	   126	 12912	     extensionHost
    0	    15	 14976	     watcherService 
    0	    11	 14004	       console-window-host (Windows internal process)
    0	    54	 15252	   electron-crash-reporter
    0	    88	 15368	   shared-process
Workspace Info
|  Window (Untitled-1 - 97fe1269f17d471191a08610fe71b956 - Visual Studio Code - Insiders)
|  Window (EditorServices.log - 1576688022-5d54cd62-c730-4487-bd08-747a9bd419e61576688019997 - Visual Studio Code - Insiders)
|    Folder (1576688022-5d54cd62-c730-4487-bd08-747a9bd419e61576688019997): 3 files
|      File types: log(3)
|      Conf files:
|    Folder (97fe1269f17d471191a08610fe71b956): 5 files
|      File types: psm1(1) ps1xml(1) dll(1) ps1(1)
|      Conf files:;

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
better-align wwm 1.1.6
better-comments aaron-bond 2.0.5
better-powershell-syntax-highlighting justin-grote 0.0.2
bracket-pair-colorizer-2 CoenraadS 0.0.29
code-settings-sync Shan 3.4.3
gc-excelviewer GrapeCity 2.1.32
gistfs vsls-contrib 0.0.21
git-graph mhutchie 1.19.1
gitlens eamodio 10.2.0
indent-rainbow oderwat 7.4.0
markdown-all-in-one yzhang 2.6.1
powershell-preview ms-vscode 2019.12.0
remote-containers ms-vscode-remote 0.96.0
remote-ssh-edit-nightly ms-vscode-remote 2019.12.24000
remote-ssh-nightly ms-vscode-remote 2019.12.24000
remote-wsl ms-vscode-remote 0.41.6
todo-tree Gruntfuggly 0.0.162
vscode-icons vscode-icons-team 9.6.0
vscode-peacock johnpapa 3.2.0
vscode-sort-json richie5um2 1.18.0
vscode-zipexplorer slevesque 0.3.1
@ghost ghost added the Needs: Triage Maintainer attention needed! label Dec 18, 2019
@SeeminglyScience
Copy link
Collaborator

It also appears to happen when just closing the terminal with the X button, so I imagine this is tied to the shutdown process in some way.

@JustinGrote
Copy link
Collaborator Author

Happened to me just now when closing it with the "trash" button on the terminal bar, toast didn't even completely appear before it froze:

image

@TylerLeonhardt
Copy link
Member

This is odd... I don't see how the extension could be causing VS Code to hang like this. I notice you are using insiders... I'm curious to know if you only experience this in insiders or it also happens in stable.

@TylerLeonhardt TylerLeonhardt added Needs-Repro-Info and removed Needs: Triage Maintainer attention needed! labels Dec 19, 2019
@JustinGrote
Copy link
Collaborator Author

JustinGrote commented Dec 20, 2019 via email

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Dec 20, 2019
@SeeminglyScience
Copy link
Collaborator

Yeah I don't use insiders, it's on stable too.

@TylerLeonhardt Are you not able to reproduce it? Maybe it's a Windows thing? It happens at least 50% of the time for me.

@PrzemyslawKlys
Copy link
Contributor

Happens for me too on stable release.

@ili101
Copy link

ili101 commented Dec 20, 2019

Are we going to get freezing consoles/VSCode until windows 21H1? can't it be fixed sooner?
microsoft/vscode#71966
microsoft/terminal#1810

Originally posted by @ili101 in PowerShell/PowerShell-RFC#238 (comment)

To reproduce write a in the console (no enter) then trash the console. VSCode will freeze.
Reproducible on Windows 10 1909 (19H2) and 1903 (19H1) I think.
Can vscode-powershell team code some workaround for this?

@SeeminglyScience
Copy link
Collaborator

@ili101 Oh wow nice find, I must have updated windows at the same time as the preview extension and didn't think about it. Unfortunately it's unlikely that this extension can do anything. Any code in this project is several layers of abstraction away from whatever is causing the issue.

@JustinGrote
Copy link
Collaborator Author

Hmm. Probably no way to proactively detect this and throw a toast or something that says "it's not Powershell's fault!"? :)

@JustinGrote
Copy link
Collaborator Author

JustinGrote commented Dec 20, 2019

microsoft/terminal#1810 references that you have to be using ConPTY for it to happen. I'm going to try unchecking this box:
image

And seeing if it still happens. If not, then that's something that can definitely be warned about, the extension can pop up a toast with "there is a known issue with using Conpty where you may experience lockups, would you like to turn it off?"

EDIT: Cure may be worse than the disease: microsoft/vscode#45693

@JustinGrote
Copy link
Collaborator Author

Added this function to my profile so that I don't have to wait forever for code to realize it is hung.

function bounceCode {get-process code* | stop-process;code}

@JustinGrote
Copy link
Collaborator Author

For update, this is stuck on microsoft/terminal#1810 until its fixed, that's the root cause it seems.

@TylerLeonhardt
Copy link
Member

yikes... ok. Well, I'm tempted to close this but for now, I'll mark it as a vscode-bug until I'm in a triage meeting with Sydney and Rob again.

@TylerLeonhardt TylerLeonhardt added Bug: VS Code Bugs in VS Code itself. and removed Needs-Repro-Info labels Dec 28, 2019
@JustinGrote
Copy link
Collaborator Author

JustinGrote commented Jan 2, 2020

According to the terminal team it can be fixed in VSCode, looking for a related issue if it already exists.
microsoft/terminal#1810 (comment)

EDIT: New issue created as microsoft/vscode#88003

@JustinGrote
Copy link
Collaborator Author

The new root issue is microsoft/node-pty#375 which vscode depends on.

@rjmholt
Copy link
Collaborator

rjmholt commented Jan 3, 2020

I just hit this issue myself. The way to differentiate this from other hangs is that the entire VSCode window will stop responding, so no responses to mouse clicks like highlighting or opening files. If I hit it again I'll get a proc dump.

@TylerLeonhardt
Copy link
Member

As a workaround, I wonder if using powershell.integratedConsole.useLegacyReadLine will have an effect here since it doesn't have PSReadLine... I doubt it though.

@Tyriar just so you're aware of this issue - there are a few folks on Twitter too who've complained about this issue.

@Tyriar
Copy link
Contributor

Tyriar commented Jan 27, 2020

@TylerLeonhardt you can also move back to winpty to avoid it as the crash is due to conpty:

"terminal.integrated.windowsEnableConpty": false

You might notice other quirks with that though.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jan 27, 2020
@andyleejordan
Copy link
Member

That sounds nice! Excited to be able to address this.

@andyleejordan andyleejordan self-assigned this Feb 25, 2021
@andyleejordan andyleejordan added this to the Consider-vNext milestone Feb 25, 2021
@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label Mar 2, 2021
@brwilkinson
Copy link

This thread is really long,.. was there a workaround for this at the moment ?

image

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Mar 9, 2021
@JustinGrote
Copy link
Collaborator Author

JustinGrote commented Mar 9, 2021

@brwilkinson This is the first part of the solution that is now in @code. @Tyriar made it so that it no longer hard locks when the original issue occurs.

At this point to recover, you just need to do the following steps:

  1. Click the Restart PTY Host
  2. Wait a moment
  3. F1 -> Powershell: Restart Current Session

And you should be back in business rather than having to wait for vscode to allow you to kill it.

The second part of the fix will hopefully be twofold:

  1. @andschwa can maybe hook into the PTY host failure event and automate the recovery steps above.
  2. @Tyriar will be able to fix what causes the "hard crash" of the powershell console in the first place (this is not a powershell specific issue, it affects all terminals, the integrated terminal just has some behavior that makes it much more likely to happen)

@brwilkinson
Copy link

Thanks @JustinGrote any preferred environment to work in for least issues?

i.e. code vs code-insiders ?
powershell extension vs powershell preview extension ?

@JustinGrote
Copy link
Collaborator Author

Happens everywhere still currently, but I'd say to avoid the crash don't ever click the "trash" button on the powershell integrated terminal, especially if you have some already-entered text at the command prompt.

The way to consistently reproduce it is to type 'a' at the integrated console and then click the trash icon, it will hard crash every time.

@brwilkinson
Copy link

brwilkinson commented Mar 9, 2021

haa I haven't had any problem trying to reproduce it 😀 ...

some days getting any work done feels like wrestling an octopus 🐙

seems like there is a plan in place. .. 👍🏻 ...

#3216 I'm in an endless loop between this other issue and this one.

@andyleejordan
Copy link
Member

@JustinGrote @brwilkinson Can either of you confirm that this is still reproducing or not on the latest version of VS Code and the preview extension? We've not automated the recovery steps, but I think the UI lockups should be gone (I can't repro on my machine).

@brwilkinson
Copy link

hmmm yes and no :) let me think about it for a day... Definitely far less crashes/freezes...

I mainly want to think about the following, which I am still seeing a little bit.

i.e. The connection to the terminal's pty host process is unresponsive, the terminals may stop working.

which then goes to

image

One thing for sure I am not currently losing any productivity over this... using powershell preview extension in both Code and Insiders.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Apr 28, 2021
@JustinGrote
Copy link
Collaborator Author

JustinGrote commented Apr 28, 2021

@andschwa UI full lockups are gone due to PTY updates but they've basically just been masked. It's easy to reproduce, just type 'a' into integrated console and kill the console

The PTY handler will crash, you have to restart it, and then you also have to coordinate the restart of the integrated console after. I think @Tyriar is still working on the PTY crash part. Maybe @TylerLeonhardt can help with a press for resources on the vscode side for this tricky issue :)

Video.mp4

@andyleejordan
Copy link
Member

just type 'a' into integrated console and kill the console

Is this in a particular environment? I've tested on my Mac and it doesn't repro.

Screen.Recording.2021-04-28.at.3.33.13.PM.mov

@JustinGrote
Copy link
Collaborator Author

I'm on Windows Insider, able to do it in both stable and insiders for years (that demo was just a few minutes ago). I don't think it's explicity OS specific, it just may require a different character to reproduce.

I think this is the most current upstream issue:
microsoft/vscode#71966

@andyleejordan
Copy link
Member

Oh...I see. IMHO terminal support on Windows is still...beta. Heck, even the Terminal app on Windows is in preview (still? I think). Thanks for the update!

@andyleejordan andyleejordan removed the Needs: Maintainer Attention Maintainer attention needed! label Apr 28, 2021
@andyleejordan andyleejordan removed their assignment Apr 28, 2021
@andyleejordan andyleejordan added this to To Do in VS Code Compatibility via automation May 25, 2021
@andyleejordan
Copy link
Member

@JustinGrote The bug you linked appears now resolved. Is this still reproducing?

@JustinGrote
Copy link
Collaborator Author

I can no longer reproduce with the "a and then trash icon" method, so hopefully we are good! @Tyriar thanks so much for finally helping put this long standing aggravating issue to bed.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Sep 22, 2021
VS Code Compatibility automation moved this from To Do to Done Sep 22, 2021
@andyleejordan andyleejordan added Resolution-External Will close automatically. and removed Needs: Maintainer Attention Maintainer attention needed! labels Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: VS Code Bugs in VS Code itself. Resolution-External Will close automatically.
Projects
No open projects
Development

No branches or pull requests