Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

PLS often crashes after installing new module #506

Closed
@erictraut

Description

@erictraut

If I install a new module using pip, typically in response to an "unresolved import" warning flagged by PLS, the server frequently crashes when trying to reload the module list.

This doesn't happen 100% of the time, but I've seen it happen at least five times already with various different modules. The problem resolves itself after the service is reloaded, but it would be better if it didn't crash.

Here's an example stack crawl:

Reloading modules... 

Unhandled Exception: System.AggregateException: One or more errors occurred. (Could not find file '/Users/eric/venvs/env367/lib/python3.6/site-packages/gevent/wsgi.py'.) ---> System.IO.FileNotFoundException: Could not find file '/Users/eric/venvs/env367/lib/python3.6/site-packages/gevent/wsgi.py'.
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Microsoft.PythonTools.Interpreter.Ast.PythonModuleLoader.FromFile(IPythonInterpreter interpreter, String sourceFile, PythonLanguageVersion langVersion, String moduleFullName)
   at Microsoft.PythonTools.Interpreter.Ast.AstModuleResolution.ImportFromSearchPaths(String name, PathResolverSnapshot pathResolver)
   at Microsoft.PythonTools.Interpreter.Ast.AstModuleResolution.TryImportModuleAsync(String name, PathResolverSnapshot pathResolver, IReadOnlyList`1 typeStubPaths, Boolean mergeTypeStubPackages, CancellationToken cancellationToken)
   at Microsoft.PythonTools.Interpreter.Ast.AstPythonInterpreter.ImportModuleAsync(String name, CancellationToken token)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout)
   at Microsoft.PythonTools.Interpreter.Ast.AstPythonInterpreter.ImportModule(String name)
   at Microsoft.PythonTools.Analysis.ModuleTable.Reload()
   at Microsoft.Python.LanguageServer.Implementation.Server.Interpreter_ModuleNamesChanged(Object sender, EventArgs e)
   at Microsoft.PythonTools.Interpreter.Ast.AstPythonInterpreter.Factory_ImportableModulesChanged(Object sender, EventArgs e)
   at Microsoft.PythonTools.Interpreter.Ast.AstPythonInterpreterFactory.NotifyImportNamesChanged()
   at Microsoft.PythonTools.Analysis.PythonAnalyzer.ReloadModulesAsync(CancellationToken token)
   at Microsoft.PythonTools.Analysis.Infrastructure.TaskExtensions.WaitAndUnwrapExceptions(Task task)
   at Microsoft.Python.LanguageServer.Implementation.Server.ReloadModulesQueueItem.Analyze(CancellationToken cancel)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Python.LanguageServer.Implementation.Server.ReloadModulesAsync(CancellationToken token)
   at Microsoft.PythonTools.Analysis.Infrastructure.TaskExtensions.<>c.<DoNotWaitThreadContinuation>b__4_0(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
[Info  - 1:28:20 PM] Connection to server got closed. Server will restart.

Metadata

Metadata

Assignees

Labels

duplicateThis issue or pull request already exists

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions