Skip to content

Editor services crashing when file in use #1499

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
PrzemyslawKlys opened this issue Aug 27, 2018 · 7 comments
Closed

Editor services crashing when file in use #1499

PrzemyslawKlys opened this issue Aug 27, 2018 · 7 comments

Comments

@PrzemyslawKlys
Copy link
Contributor

System Details

  • Operating system name and version:
  • VS Code version:
  • PowerShell extension version:
  • Output from $PSVersionTable:
PS C:\Users\pklys\OneDrive - Evotec\Support\GitHub\LittleInfrastructureManager\Examples> $pseditor.EditorServicesVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
1      8      3      0


PS C:\Users\pklys\OneDrive - Evotec\Support\GitHub\LittleInfrastructureManager\Examples> code --list-extensions --show-versions
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
openssl config failed: error:02001003:system library:fopen:No such process
PS C:\Users\pklys\OneDrive - Evotec\Support\GitHub\LittleInfrastructureManager\Examples> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.17746.1000
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17746.1000
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

I am experiencing a problem with... Editor Services Crashing. I use VSCode with git but also all files are stored on OneDrive. So it's possible that when I save OneDrive (I'm guessing here) kicks in at same time that Format on Save (since this error happens on Save) and I believe this is related to that.

VERBOSE: Wrote out session file
VERBOSE: 
#-- Waiting for EditorServicesHost to complete execution ---------------------
VERBOSE: ERRORS caught while waiting for EditorServicesHost to complete execution
VERBOSE: One or more errors occurred.
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at CallSite.Target(Closure , CallSite , Object )
VERBOSE: One or more errors occurred.
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at CallSite.Target(Closure , CallSite , Object )
One or more errors occurred.
VERBOSE: One or more errors occurred.
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at CallSite.Target(Closure , CallSite , Object )
One or more errors occurred.

The process cannot access the file 'c:\Users\pklys\OneDrive - Evotec\Support\GitHub\LittleInfrastructureManager\Examples\TaskScheduled-InfraManager.ps1' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost)
   at System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost)
   at Microsoft.PowerShell.EditorServices.LanguageService.<FindReferencesOfSymbol>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.PowerShell.EditorServices.CodeLenses.ReferencesCodeLensProvider.<ResolveCodeLensAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.PowerShell.EditorServices.CodeLenses.CodeLensFeature.<HandleCodeLensResolveRequest>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.MessageDispatcher.<DispatchMessage>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol.ProtocolEndpoint.<ListenForMessages>d__36.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.PowerShell.EditorServices.Utility.AsyncContext.Start(Func`1 asyncMainFunc, ILogger logger)
   at System.Threading.Tasks.Task.Execute()
PS>$global:?
True
**********************
Windows PowerShell transcript end
End time: 20180827215048
**********************

Attached Logs

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

EditorServices.zip

@rjmholt
Copy link
Contributor

rjmholt commented Aug 27, 2018

Going to close this as a duplicate of #1471.

@PrzemyslawKlys you'll be pleased to know that we're about to merge a fix for this one: PowerShell/PowerShellEditorServices#732.

@rjmholt rjmholt closed this as completed Aug 27, 2018
@PrzemyslawKlys
Copy link
Contributor Author

Great :-) Weirdly enough I started to experience this for first time in last 2 days. Before it was ok.

@rjmholt
Copy link
Contributor

rjmholt commented Aug 28, 2018

Yeah I'm similar -- first time I got this crash was a couple of weeks ago. I just assumed that deleting a file while it's under CodeLens anaylsis is a rare scenario. The fix was for a fairly old piece of code. Anyway, it's fixed now and we actually got a 10x CodeLens performance improvement out of it too.

@PrzemyslawKlys
Copy link
Contributor Author

I'm really excited working in VSCode and PowerShell. It's so great tool even with those crashes I can't get back and sooner or later we will be getting less and less problems.

@rjmholt
Copy link
Contributor

rjmholt commented Aug 28, 2018

I hope so! We're wrangling with some technical debt, but I'm hoping we can make some solid improvements in the coming months.

The debugger is the next problem area. It really didn't like the move to named pipes, but we didn't have much choice on that one.

@TylerLeonhardt
Copy link
Member

@rjmholt, that PR was to address when the file goes missing but this issue is when PSES can not access the file in question because something else is using it.

The change does catch an IOException:
https://github.com/PowerShell/PowerShellEditorServices/pull/732/files#diff-c32df74a02ef5cb6a69bfa0fcfd0162bR335

I would like to assume this would catch the error in question above: System.IO.__Error.WinIOError... But I'm not sure 100%

@rjmholt
Copy link
Contributor

rjmholt commented Aug 28, 2018

Yes I was working on the assumption that catching an IOException will handle this. I get the impression that it mostly will (in fact I think it always will for a "SHARING VIOLATION")

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

3 participants