Skip to content

Powershell extension crashing randomly #1704

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
wrsbrewerton opened this issue Jan 18, 2019 · 17 comments
Closed

Powershell extension crashing randomly #1704

wrsbrewerton opened this issue Jan 18, 2019 · 17 comments

Comments

@wrsbrewerton
Copy link

Issue Type: Performance Issue

Hello

Apolgies, I cannot really say how to reproduce, but while working in VSCode using the PoweShell extension, the integrated terminal will show and error saying PowerShell has terminated and do I wish to restart it

Sometimes it seems to happen even without my changing or running anything, simply highlighting content in an unsaved file can sometimes trigger it

I did turn diagnostic level logging on to try and capture useful information

I can see the error at the end of the 'EditorServices.log' but I cannot comprehend thae cause behind it

My setup is

Windows 10 Enterprise 1803
VSCode 1.30.2 (user setup)
PowerShell extension version 1.10.2

If I can provide anything further please let me know

Many thanks

Extension version: 1.10.2
VS Code version: Code 1.30.2 (61122f88f0bf01e2ac16bdb9e1bc4571755f5bd8, 2019-01-07T22:54:13.295Z)
OS version: Windows_NT x64 10.0.17134

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz (8 x 2112)
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.85GB (4.84GB free)
Process Argv
Screen Reader no
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
    0	    80	 13972	code main
    0	    69	 10080	   shared-process
    0	   307	 11348	   window (Repos - Visual Studio Code)
    0	    13	  3352	     electron-crash-reporter
    0	   170	 12220	     searchService
    0	    68	 12628	     extensionHost
    0	    14	 17692	     watcherService 
    0	    10	 16900	       console-window-host (Windows internal process)
    0	     6	 19948	     winpty-process
    0	    67	 10400	       C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
    0	     9	 17384	       console-window-host (Windows internal process)
    0	    69	 17824	   window (Issue Reporter)
    0	   174	 18872	   gpu-process
Workspace Info
|  Window (Repos - Visual Studio Code)
|    Folder (Repos): 16895 files
|      File types: json(3349) dll(2302) py(1903) xml(929) md(880) ps1(776)
|                  js(723) png(585) pyc(511) sh(480)
|      Conf files: csproj(23) package.json(20) sln(19) grunt.js(5)
|                  settings.json(4) tsconfig.json(2) tslint.json(2)
|                  makefile(1) gulp.js(1);

VScode-ps-logs.zip

@SydneyhSmith
Copy link
Collaborator

@wrsbrewerton thanks for reporting this and including the logs. I was just giving them a look and noticed that your file was called "Untitled-7" I am wondering if this was a file name you had saved or if the file you were working on had not yet been saved when you started crashing?

@kongsted
Copy link

Hi,
Just want to let you know, that I'm seeing the same behavior. This morning, I have been using VSCode for Powershell for half an hour without any problem. Suddenly VSCode is crashing a couple of times.
In this case I didn't had any unsaved documents opened. I had 3 files opened - .ps1, .txt and .csv.

I found the attached exception in the log.
20190122-VSCodeCrash-1.txt

//Anders

@rkeithhill
Copy link
Contributor

@kongsted Do you have files on a network share? Cause the error I'm seeing is:

System.IO.IOException: An unexpected network error occurred.

@brianmccarty
Copy link

I am also having regular crashes of the Powershell extension, many times without any interaction with the window.

Extension version: 1.10.2
VS Code version: Code 1.30.2
OS version: Windows_NT x64 10.0.17763

I've enabled Verbose logging, where do I find the log files to be able to send in any errors.

@kongsted
Copy link

@kongsted Do you have files on a network share? Cause the error I'm seeing is:

System.IO.IOException: An unexpected network error occurred.

Yes, it's correct it's on a network-share. But I don't have any problems with that share in any other cases (there's is 1000+ users connected to the share, so I believe I would have heard if it didn't work ;) ).

@kongsted
Copy link

I am also having regular crashes of the Powershell extension, many times without any interaction with the window.

Extension version: 1.10.2
VS Code version: Code 1.30.2
OS version: Windows_NT x64 10.0.17763

I've enabled Verbose logging, where do I find the log files to be able to send in any errors.

@brianmccarty you can finde the log-files here
c:\users<username>.vscode\extensions\ms-vscode.powershell-\logs
Then order by date, and find the folder needed.

@wrsbrewerton
Copy link
Author

wrsbrewerton commented Jan 23, 2019

I just had a new crash very soon after opening VScode and starting a new file
Grabbed the log files again as it was a fresh set with the crash happening quite quickly after launching there will hopefully be less noise in them....

1704.zip

@rjmholt
Copy link
Contributor

rjmholt commented Jan 23, 2019

here's how to get logs

@rjmholt
Copy link
Contributor

rjmholt commented Jan 23, 2019

I get the impression that most in this thread are seeing #1683 (#1695 seems to be the same issue as well).

In @kongsted's case, it looks like there's a crash occurring when we try to enumerate files on a network share. There's not much specific to go on there, but I'm guessing that when we eagerly recursively enumerate the filesystem we hit funny bits that users aren't. Either way, that should be easily defended against by catching an IOException here — unclear to me why we don't already.

@SydneyhSmith
Copy link
Collaborator

While we are working to merge in #862 to fix this it would also be helpful if you all updated to the latest version of the extension to test if the updates so far have helped!

@wrsbrewerton
Copy link
Author

So I've been running 1.11.0 since it became available and I have not had any repeat behaviour so far, has been solid

HTH

@kongsted
Copy link

An update - have been running with 1.11.0 for a couple of days now.
The problem happens not as often as before, but it just crashed for me (after more than an hour working in VScode). Error-code:
`2019-01-29 12:00:45.695 [ERROR] tid:51 in 'OnListenTaskCompleted' C:\PowerShellEditorServices\src\PowerShellEditorServices.Protocol\MessageProtocol\ProtocolEndpoint.cs: line 391
ProtocolEndpoint message loop terminated due to unhandled exception:

System.AggregateException: One or more errors occurred. ---> System.IO.IOException: An unexpected network error occurred.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileSystemEnumerableIterator`1.CommonInit()
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
   at System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption)`

Cheers
Anders

@rkeithhill
Copy link
Contributor

rkeithhill commented Jan 29, 2019

@kongsted Can you post the full log here? For instance, the stack trace you show is cut off before it reaches the extension's code. So we can't easily tell where in the code base this is being invoked. Thanks.

Here's how to get logs.

@brianmccarty
Copy link

Still crashing on a regular basis.
Version: 1.31.0-insider (system setup)
Commit: 9606490e26f8cbe4d615305389d45e9b144ded7c
Date: 2019-01-30T15:20:25.145Z
Electron: 3.1.2
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.17763

vscode-powershell.zip

@kongsted
Copy link

@rkeithhill I have attached the log-files here:

1548919315-1523c686-6beb-46f3-9218-94f8cb3a64351548919311947.zip

This crash happened just after I changed workspace in VS Code.

@rkeithhill
Copy link
Contributor

OK, the error happens when we recursivley iterate over the workspace files and is caused by a network error:

    ---> (Inner Exception #0) System.IO.IOException: An unexpected network error occurred.
    
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.FileSystemEnumerableIterator`1.CommonInit()
       at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
       at System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption)
       at Microsoft.PowerShell.EditorServices.Workspace.RecursivelyEnumerateFiles(String folderPath, List`1& foundFiles, Int32 currDepth)
       at Microsoft.PowerShell.EditorServices.Workspace.RecursivelyEnumerateFiles(String folderPath, List`1& foundFiles, Int32 currDepth)
       at Microsoft.PowerShell.EditorServices.Workspace.EnumeratePSFiles()
       at Microsoft.PowerShell.EditorServices.LanguageService.<FindReferencesOfSymbol>d__18.MoveNext()

@rjmholt I thought we added a catch handler for IOException for this case?

@rjmholt
Copy link
Contributor

rjmholt commented Feb 4, 2019

@rjmholt I thought we added a catch handler for IOException for this case?

We should be catching all catch-able exceptions (I recall going to add an IOException catch and realising that we should just catch anything we can and move on):

https://github.com/PowerShell/PowerShellEditorServices/blob/ac9d57a78f0dff0b05576f19a63367d36292147c/src/PowerShellEditorServices/Workspace/Workspace.cs#L349-L356

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants