Extension/Integrated Console hangs on startup before prompt
Issue Type: Bug
Open Visual Studio Code (the terminal window won't load after five minutes with 30 gb of RAM).
Extension version: 2019.5.0 VS Code version: Code 1.35.0 (553cfb2c2205db5f15f3ee8395bbd5cf066d357d, 2019-06-04T01:17:12.481Z) OS version: Windows_NT x64 10.0.17763
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz (4 x 2808) |
| GPU Status | 2d_canvas: disabled_software checker_imaging: disabled_off flash_3d: disabled_software flash_stage3d: disabled_software flash_stage3d_baseline: disabled_software gpu_compositing: disabled_software multiple_raster_threads: disabled_off native_gpu_memory_buffers: disabled_software rasterization: disabled_software surface_synchronization: disabled_off video_decode: disabled_software webgl: disabled_off webgl2: disabled_off |
| Load (avg) | undefined |
| Memory (System) | 23.87GB (12.35GB free) |
| Process Argv | |
| Screen Reader | no |
| VM | 0% |
I second this motion. Was about to open an issue myself. The console window just shows PowerShell Integrated Console and that's it.
Thanks for opening an issue. If we can find a way to reproduce it, we can hopefully fix it.
the terminal window won't load after five minutes with 30 gb of RAM
This is likely not a performance issue.
A couple of questions:
- If you go to the Integrated Console and press Enter, does it then continue?
- When did this last work for you? Did it stop working when VSCode (not the extension) updated? Or when the PowerShell extension updated at the end of May?
- In @metalmensch's case, does it display anything in the terminal? Do you have a PowerShell file open?
- In @MarkKharitonov's case, what operating system (and version) are you running?
- If you try to restart the PowerShell extension session (with Ctrl+Shift+P
PowerShell: Restart Current Session), what happens? - If you open a native
powershellorpwshterminal, does a similar problem occur?
We're aware of a Windows bug that's been affecting recent VSCode builds in which the terminal doesn't behave properly, so that's my current suspicion.
See also: https://github.com/PowerShell/vscode-powershell/issues/1795#issuecomment-479067928
It looks like it was being stopped by a pending windows update on my end. I rebooted, and it seems to have gone back to working.
On Thu, Jun 6, 2019 at 1:24 PM Robert Holt [email protected] wrote:
One test is: if you go to an ordinary native powershell terminal, does something similar happen?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PowerShell/vscode-powershell/issues/2014?email_source=notifications&email_token=AGUA7HPI6VOVBAHPXJ6CUATPZFW75A5CNFSM4HVICWCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXEBWAY#issuecomment-499653379, or mute the thread https://github.com/notifications/unsubscribe-auth/AGUA7HNSFF5GREBENDQTSZ3PZFW75ANCNFSM4HVICWCA .
I would like to answer the questions:
- If you go to the Integrated Console and press Enter, does it then continue?
No, still stuck at PowerShell Integrated Console
- When did this last work for you? Did it stop working when VSCode (not the extension) updated? Or when the PowerShell extension updated at the end of May?
Sorry, but I do not know.
- In @MarkKharitonov's case, what operating system (and version) are you running?
I have two machines. On the "good" the Powershell console opens OK., On the "bad" - it is stuck. In both cases it is Windows 10. Here is the info: "Bad" Machine Powershell Integrated Console hangs, pressing Enter does not help. At least not in the first N minutes, where N is sizeable (10?) VS Code
Version: 1.34.0 (system setup)
Commit: a622c65b2c713c890fcf4fbf07cf34049d5fe758
Date: 2019-05-15T21:59:37.030Z
Electron: 3.1.8
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.17763
Powershell extension
Name: PowerShell
Id: ms-vscode.powershell
Description: Develop PowerShell scripts in Visual Studio Code!
Version: 2019.5.0
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell
"Good" Machine VS Code
Version: 1.34.0 (system setup)
Commit: a622c65b2c713c890fcf4fbf07cf34049d5fe758
Date: 2019-05-15T21:59:37.030Z
Electron: 3.1.8
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.16299
Powershell extension
Name: PowerShell
Id: ms-vscode.powershell
Description: Develop PowerShell scripts in Visual Studio Code!
Version: 2019.5.0
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell
- If you try to restart the PowerShell extension session (with Ctrl+Shift+P PowerShell: Restart Current Session), what happens?
Same thing - it hangs.
- If you open a native powershell or pwsh terminal, does a similar problem occur?
No.
Hmmm it certainly looks like the only difference between machines is the Windows version (which implies it may be the Windows bug).
Another thing it might be worth doing is turning the logging up to Diagnostic and seeing how far you get through startup
Actually on the "bad" machine hitting many times Enter does force the console to show the prompt. So, yes - hitting multiple times Enter shows the console. But, it does not load the profile.
I will get the logs later.
hitting multiple times Enter shows the console
Yeah that sounds like the relevant Windows bug.
But, it does not load the profile
Which profile is that? The PowerShell extension looks for the profile in ~\Documents\PowerShell\Microsoft.VSCode_profile.ps1. I assume this works on the good machine?
Yes, it does not load the $PROFILE, whatever it should be in this context. Does load on the "good" machine.
Note that once the prompt is shown explicitly loading $PROFILE works fine.
Note that once the prompt is shown explicitly loading $PROFILE works fine.
Ohhhh, as in it loads once you press Enter?
Yeah that's because this Windows bug just stops the startup from proceeding (it's a bug in the Windows console APIs), before it can get to the profile execution stage. It's like if you put Wait-Debugger at the start of your profile.
The fix lies below the extension -- it's something we depend on VSCode and Windows for. From what I can tell, the fix is to run Windows update.
Well, it does not load when I press Enter. But when I run . $PROFILE at the prompt it loads without a problem.
So, who knows what happens with this bug? Is it the Windows team? The VS Code team? Who is the address to get some info on ETA of the fix?
Well, it does not load when I press Enter
Ah, I misunderstood earlier. Given that, we still need more information to determine the bug.
If it's a Windows/VSCode terminal API problem, the fix is almost certainly already available and it's just a matter of you getting it.
But when I run . $PROFILE at the prompt it loads without a problem.
Is this still the Integrated Console? What's the value of $profile? Do you get PS extension features like intellisense and diagnostics?
I think the best option is to make sure you have a clean, up-to-date environment:
- Uninstall VSCode
rm -fo -r ~\.vscode- Install any pending Windows updates
- Restart your machine
- Install VSCode
- Install the PowerShell extension
- Check for the bug
- If it persists, Install VSCode Insiders
- Install the PowerShell extension in VSCode insiders
- If the bug's still there at that point, turn on diagnostic logging and upload your logs here. Particularly of interest would be the terminal's execution trace from the startup script.
- If we still find nothing, I would suspect security policy or some kind of system lockdown that causes PowerShell to lock up when trying to execute some step. Antivirus software sometimes likes to silently stop execution in our startup script
@MarkKharitonov were you able to resolve this with @rjmholt's suggestion of uninstalling, and reinstalling VSCode or are you still facing this issue? Thanks!
It is a bit heavy for me right now. Did not have time to do it yet.
I can only say that I no longer have the "good" machine - both are "bad" :-(.
I am having the same issue. I've found that when manually running the "args" command from Powershell itself, this code hangs indefinitely.
C:\Users\jrichardson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2019.5.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\jrichardson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\Users\jrichardson\.vscode\extensions\ms-vscode.powershell-2019.5.0\logs\1561381335-dcf17219-d54a-40bc-bdd5-bad88ba69ed21561381331557\EditorServices.log' -SessionDetailsPath 'C:\Users\jrichardson\.vscode\extensions\ms-vscode.powershell-2019.5.0\sessions\PSES-VSCode-21768-408591' -FeatureFlags @()
PS displays "PowerShell Integrated Console" and then does not proceed any further.
VSCode with debug enabled shows:
VERBOSE:
#-- Console Encoding ---------------------------------------------------------
VERBOSE: System.Text.ASCIIEncoding
VERBOSE:
#-- Updated PSModulePath to: -------------------------------------------------
VERBOSE: P:\Documents\WindowsPowerShell\Modules
VERBOSE: C:\Program Files\WindowsPowerShell\Modules
VERBOSE: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
VERBOSE: C:\Users\jrichardson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules
VERBOSE:
#-- Check required modules available -----------------------------------------
VERBOSE: Testing module availability PowerShellGet
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1'.
VERBOSE: PowerShellGet found
VERBOSE:
#-- Start up PowerShellEditorServices ----------------------------------------
VERBOSE: Importing PowerShellEditorServices
VERBOSE: Loading module from path 'C:\Users\jrichardson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'.
VERBOSE: Loading module from path 'C:\Users\jrichardson\.vscode\extensions\ms-vscode.powershell-2019.5.0\modules\PowerShellEditorServices\PowerShellEditorServices.psm1'.
VERBOSE: Exporting function 'Start-EditorServicesHost'.
VERBOSE: Exporting function 'Compress-LogDir'.
VERBOSE: Exporting function 'Get-PowerShellEditorServicesVersion'.
VERBOSE: Importing function 'Compress-LogDir'.
VERBOSE: Importing function 'Get-PowerShellEditorServicesVersion'.
VERBOSE: Importing function 'Start-EditorServicesHost'.
PowerShell Integrated Console
VERBOSE: Invoking Start-EditorServicesHost
VERBOSE: Start-EditorServicesHost returned Microsoft.PowerShell.EditorServices.Host.EditorServicesHost
VERBOSE: Writing session file with contents:
VERBOSE: {"languageServiceTransport":"NamedPipe","languageServicePipeName":"\\\\.\\pipe\\PSES_zz3sudvm.tgn","debugServiceTransport":"NamedPipe","status":"started","debugServicePipeName":"\\\\.\\pipe\\PSES_sk3vhecb.1ba"}
VERBOSE: Wrote out session file
VERBOSE:
#-- Waiting for EditorServicesHost to complete execution ---------------------
@JR70386 If you're running the startup script directly, that's intended behaviour. The script starts the backend and then waits patiently for a client to connect before proceeding. If there's no client, it will just wait indefinitely. Are you having trouble starting PowerShell from VSCode?
@MarkKharitonov Did you get a chance to try out those steps?
I have the same behaviour here and just tried something out (please see attached images):
1: Started VSCode with a Powershell Script ==> the prompt doesn't show up 2: Typed a character (in this case: "c") ==> the prompt is there 3: Made the Terminal window larger and restarted Code ==> everything's fine without the need to type a character or pressing enter twice.
So it looks like the shell is there, it's just not showing up correctly. Can you check this out on your machine(s)?
1: after initial start

2: after pressing "c"

3: after initial start with a larger terminal

@rjmholt Yes, I'm having trouble starting a PS terminal in VSCode. The behavior is similar, so that's why I brought up my manual tests.
Have just been thinking on this issue.
The commonalities seem to be:
- Running on Windows 10, not newer than 1809
- Windows PowerShell (i.e. not PS 6+)
Because this seems to be quite platform- and version-dependent, we need to collect more information (because we aren't able to reproduce it ourselves).
For everyone affected, please turn your log level up to diagnostic and send through your logs after a fresh startup/hang of the extension. It's also important to know which log files aren't generated, so be sure to list the log files you find (the easiest way is usually to zip the log directory and send that).
To properly debug this, it's likely you'll need to collect a dump. The easiest way is to use procdump -ma $psesPid where $psesPid is the PID of the powershell.exe process running the language server (try gps *powershell* | ? { $_.Parent -like '*code*' } to get this).
If you are able to send a dump of the hang through to us, it should be straightforward to work out where the problem lies. Please note that dumps can contain a lot of information, so you can send them directly (probably with a download link) to [email protected].