Skip to content

Powershell terminated due to Untitled Files #1683

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

Closed
EricVanAken opened this issue Jan 7, 2019 · 21 comments
Closed

Powershell terminated due to Untitled Files #1683

EricVanAken opened this issue Jan 7, 2019 · 21 comments
Labels
Issue-Performance Something's slow.

Comments

@EricVanAken
Copy link

EricVanAken commented Jan 7, 2019

Issue Type: Bug

when using VS Code to manage my 365 & Azure services my powershell is crashing all the time

The log:

1/7/2019 2:37:11 PM [NORMAL] - Visual Studio Code v1.30.1 64-bit
1/7/2019 2:37:11 PM [NORMAL] - PowerShell Extension v1.10.2
1/7/2019 2:37:11 PM [NORMAL] - Operating System: Windows 64-bit
1/7/2019 2:37:11 PM [NORMAL] - Path specified by 'powerShellExePath' setting - '' - not found, reverting to default PowerShell path.
1/7/2019 2:37:11 PM [NORMAL] - Language server starting --
1/7/2019 2:37:11 PM [NORMAL] -     exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
1/7/2019 2:37:11 PM [NORMAL] -     args: C:\Users\USER\.vscode\extensions\ms-vscode.powershell-1.10.2\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.10.2' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\USER\.vscode\extensions\ms-vscode.powershell-1.10.2\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\Users\USER\.vscode\extensions\ms-vscode.powershell-1.10.2\logs\1546868231-e64619ea-75b4-4072-ad3f-e3d17d9cdc0a1546868227533\EditorServices.log' -SessionDetailsPath 'C:\Users\USER\.vscode\extensions\ms-vscode.powershell-1.10.2\sessions\PSES-VSCode-15988-512096' -FeatureFlags @()
1/7/2019 2:37:11 PM [NORMAL] - powershell.exe started, pid: 17224
1/7/2019 2:37:13 PM [NORMAL] - Language server started.
1/7/2019 2:37:13 PM [NORMAL] - {"languageServiceTransport":"NamedPipe","languageServicePipeName":"\\\\.\\pipe\\PSES_b1gpjnf0.2ul","debugServiceTransport":"NamedPipe","status":"started","debugServicePipeName":"\\\\.\\pipe\\PSES_nzcdqmkj.41o"}
1/7/2019 2:37:13 PM [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_b1gpjnf0.2ul...
1/7/2019 2:37:13 PM [NORMAL] - Language service connected.
1/7/2019 2:39:05 PM [NORMAL] - powershell.exe terminated or terminal UI was closed
1/7/2019 2:39:11 PM [NORMAL] - Shutting down language client...
1/7/2019 2:39:11 PM [NORMAL] - Path specified by 'powerShellExePath' setting - '' - not found, reverting to default PowerShell path.
1/7/2019 2:39:11 PM [NORMAL] - Language server starting --
1/7/2019 2:39:11 PM [NORMAL] -     exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
1/7/2019 2:39:11 PM [NORMAL] -     args: C:\Users\USER\.vscode\extensions\ms-vscode.powershell-1.10.2\modules\PowerShellEditorServices\Start-EditorServices.ps1 -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.10.2' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\USER\.vscode\extensions\ms-vscode.powershell-1.10.2\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\Users\USER\.vscode\extensions\ms-vscode.powershell-1.10.2\logs\1546868351-e64619ea-75b4-4072-ad3f-e3d17d9cdc0a1546868227533\EditorServices.log' -SessionDetailsPath 'C:\Users\USER\.vscode\extensions\ms-vscode.powershell-1.10.2\sessions\PSES-VSCode-15988-744644' -FeatureFlags @()
1/7/2019 2:39:12 PM [NORMAL] - powershell.exe started, pid: 5284
1/7/2019 2:39:13 PM [NORMAL] - Language server started.
1/7/2019 2:39:13 PM [NORMAL] - {"languageServiceTransport":"NamedPipe","languageServicePipeName":"\\\\.\\pipe\\PSES_fcibqsfu.apc","debugServiceTransport":"NamedPipe","status":"started","debugServicePipeName":"\\\\.\\pipe\\PSES_zt1wz0hq.pdb"}
1/7/2019 2:39:13 PM [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_fcibqsfu.apc...
1/7/2019 2:39:13 PM [NORMAL] - Language service connected.
1/7/2019 2:42:09 PM [NORMAL] - powershell.exe terminated or terminal UI was closed

Extension version: 1.10.2
VS Code version: Code 1.30.1 (dea8705087adb1b5e5ae1d9123278e178656186a, 2018-12-18T18:12:07.165Z)
OS version: Windows_NT x64 10.0.18309

System Info
Item Value
CPUs Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz (4 x 2592)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Memory (System) 15.90GB (8.17GB free)
Process Argv
Screen Reader no
VM 0%
@SydneyhSmith SydneyhSmith added the Issue-Performance Something's slow. label Jan 7, 2019
@SydneyhSmith
Copy link
Collaborator

@EricVanAken we are working to address performance issues, but do always appreciate more logs--thanks for reporting this! You mentioned that PowerShell is terminating frequently, have you noticed any patterns of when this happens or is it pretty much random/always?

@EricVanAken
Copy link
Author

@SydneyhSmith,

This is occurring really randomly but if it happens the first 3 to 4 session terminate and the I looks like it is working stable.

To add, I'm running Windows 10 insider fast ring

@KaylorDave
Copy link

Adding some logs here. Integrated terminal is failing, a cursory look through the logs seems to indicate it is failing when it tries to run Get-Command against something it shouldn't be running that against anyway because it's a file? Not sure, but that's where I see a lot of red.
vscodelogs1-8-19.zip

@KaylorDave
Copy link

Additional notes in case they help, I'm not even utilizing the integrated terminal, I let it run for Intellisense and I run my code in a separate process. It is failing with no action on my part and I cannot reproduce as it just dies all on its own randomly (seemingly random at least).

@SydneyhSmith
Copy link
Collaborator

@KaylorDave thanks for that, the information is helpful. It would be great if you and @EricVanAken could provide us with verbose logs as well, the information for how to do this is https://github.com/PowerShell/vscode-powershell/blob/master/docs/troubleshooting.md#providing-information-about-your-environment

@KaylorDave
Copy link

I've enabled verbose logging so the next time it happens I'll have more for you.

@KaylorDave
Copy link

More logs for you, happened again. This time it occurred immediately after changing language mode on my active Untitled file from PowerShell (my default) to PlainText.
vscodelogsdump2_1-8-19.zip

@EricVanAken
Copy link
Author

I will enable verbose logging, when it happens again ill post and update

@lehtoj
Copy link

lehtoj commented Jan 10, 2019

I am also having this problem. Ever since Windows 10 upgraded from 1607 to 1803 some weeks back, PowerShell in VSCode crashes constantly. All I have to do is paste some text or type a few characters, wait a second or two and then I get pop-up "The PowerShell session has terminated due to an error, would you like to restart it?".

Unlike the OP's issue, my crashes aren't related to O365 scripts.

ISE works without issues.

In output there is only one new line when the crashes occur.
1/10/2019 1:33:34 PM [NORMAL] - powershell.exe terminated or terminal UI was closed

The crashes are so frequent that this has pretty much made VSCode useless for me.

@rkeithhill
Copy link
Contributor

rkeithhill commented Jan 10, 2019

This is a folding provider bug (that @KaylorDave is seeing) that I believe I have fixed in this PR. The relevant section of the log is:

       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
       at Microsoft.PowerShell.EditorServices.Workspace.GetFile(String filePath)
       at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.Fold(String documentUri)

@KaylorDave
Copy link

Sent some additional logs along to the '[email protected]' email since it contained some more sensitive information.

@jhoneill
Copy link

Seeing the description for PR @rkeithhill mentions, this may be the same problem I'm having - paste into an file - especially an unnamed file, and especially if syntactically bad , will causes powershell to terminate, but I have not found a reliable way to provoke it. Nor can I pin down which recent update changed matters but since mid December crashes have gone from almost-never, to every few minutes.
Hoping that fix covers both and gets pushed soon,

@KaylorDave
Copy link

More logs-
logdump_1-15-19.zip

@KaylorDave
Copy link

I agree with @jhoneill this appears to be happening because I have PowerShell set as my default language for new files in VSCode. When I paste in something that's not PowerShell the integrated terminal crashes after a few seconds. I can't always reproduce this though.

@KaylorDave
Copy link

Happened again on a brand new window, this time I changed my language mode out of powershell prior to the crash. logdump2_1-15-19.zip

@KaylorDave
Copy link

Ok, 3rd crash in as much time. This time I was just typing some markdown...
logdump3_1-15-19.zip

@rkeithhill
Copy link
Contributor

rkeithhill commented Jan 15, 2019

The first zip file above is the same old Folding bug that should be fixed in the next release. The last two are new and associated with providing Comment Help:

    System.AggregateException: One or more errors occurred. (Could not find file 'C:\Users\kaylorw\untitled:Untitled-1'.) ---> System.IO.FileNotFoundException: Could not find file 'C:\Users\kaylorw\untitled:Untitled-1'.
       at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
       at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
       at Microsoft.PowerShell.EditorServices.Workspace.GetFile(String filePath)
       at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.HandleCommentHelpRequest(CommentHelpRequestParams requestParams, RequestContext`1 requestContext)

The fix should be easy. The workaround for now is the same as with the Folding bug, save an "untitled" file to disk as soon as possible.

BTW looks like another case where we should be using TryGetFile(). I should be able to knock this one out tonight.

@KaylorDave
Copy link

Thanks for taking a look @rkeithhill! Looking forward to a fix as I tend to use unsaved Untitled files for random temporary stuff all the time.

@EricVanAken
Copy link
Author

Haven't been using VS code much the last days so still no crash.
When i have one ill post my logging.

@SydneyhSmith SydneyhSmith changed the title Powershell terminated Powershell terminated due to Untitled Files Jan 17, 2019
@KaylorDave
Copy link

KaylorDave commented Jan 24, 2019

I'm not seeing these crashes anymore since the update, seems resolved for me.

Thanks!

@TylerLeonhardt
Copy link
Member

I'll close this then 😊 thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Performance Something's slow.
Projects
None yet
Development

No branches or pull requests

7 participants