Python-language-server: Microsoft.Python.LanguageServer excessive resource usage

Created on 17 Dec 2018  Â·  11Comments  Â·  Source: microsoft/python-language-server

@KaiLicht commented on Sun Dec 16 2018

Environment data

  • VS Code version: 1.30.0
  • Extension version (available under the Extensions sidebar): 2018.12.1
  • OS and version: macOS 10.14.1
  • Python version (& distribution if applicable, e.g. Anaconda): Anaconda, Python 3.7.0
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Relevant/affected Python packages and their versions: --

Expected behaviour

Microsoft.Python.LanguageServer is using a reasonable amount of ressources.

Actual behaviour

Microsoft.Python.LanguageServer is using 100%+ CPU Power which is of course draining my battery very fast.

Steps to reproduce:

  1. Install and git pull the library fast.ai
  2. Open the folder in VSCode

Logs

Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)

There's no output generated.

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

[ms-python.python]: Command `python.datascience.exportoutputasnotebook` appears multiple times in the `commands` section.
TMSyntax.ts:46 Overwriting grammar scope name to file mapping for scope source.python.
Old grammar file: file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/extensions/python/syntaxes/MagicPython.tmLanguage.json.
New grammar file: file:///Users/kai/.vscode/extensions/magicstack.magicpython-1.1.0/grammars/MagicPython.tmLanguage
e.register @ TMSyntax.ts:46
t._handleGrammarExtensionPointUser @ TMSyntax.ts:329
(anonymous) @ TMSyntax.ts:182
e._handle @ extensionsRegistry.ts:114
e.acceptUsers @ extensionsRegistry.ts:98
t._handleExtensionPoint @ extensionService.ts:490
t._onHasExtensions @ extensionService.ts:344
(anonymous) @ extensionService.ts:332
(anonymous) @ errors.ts:237
s.__generator.a.label @ errors.ts:237
s @ errors.ts:237
Promise resolved (async)
c @ errors.ts:237
s @ errors.ts:237
Promise resolved (async)
c @ errors.ts:237
o @ errors.ts:237
o @ errors.ts:237
t._scanAndHandleExtensions @ extensionService.ts:319
(anonymous) @ extensionService.ts:114
requestIdleCallback (async)
t.runWhenIdle @ async.ts:730
(anonymous) @ extensionService.ts:111
Promise resolved (async)
t._startDelayed @ extensionService.ts:109
t @ extensionService.ts:90
t.create @ types.ts:165
e._createInstance @ instantiationService.ts:104
e.createInstance @ instantiationService.ts:69
t.initServiceCollection @ shell.ts:466
t.renderContents @ shell.ts:171
t.open @ shell.ts:528
(anonymous) @ main.ts:147
Promise resolved (async)
(anonymous) @ main.ts:129
Promise resolved (async)
(anonymous) @ main.ts:125
Promise resolved (async)
(anonymous) @ main.ts:116
G @ main.ts:86
(anonymous) @ workbench.js:30
Promise resolved (async)
bootstrapWindow.load.removeDeveloperKeybindingsAfterLoad @ workbench.js:26
exports.load.e @ bootstrap-window.js:123
t._invokeFactory @ loader.js:970
t.complete @ loader.js:980
s._onModuleComplete @ loader.js:1580
s._onModuleComplete @ loader.js:1592
s._onModuleComplete @ loader.js:1592
s._onModuleComplete @ loader.js:1592
s._resolve @ loader.js:1542
s.defineModule @ loader.js:1206
s._onLoad @ loader.js:1283
(anonymous) @ loader.js:1453
e.triggerCallback @ loader.js:594
(anonymous) @ loader.js:588
t.load @ loader.js:745
e.load @ loader.js:588
i @ loader.js:1448
(anonymous) @ loader.js:1456
e.triggerErrorback @ loader.js:601
(anonymous) @ loader.js:588
(anonymous) @ loader.js:751
readFileAfterOpen @ fs.js:420
extensionHost.ts:329 [Extension Host] debugger listening on port 65352
extensionHost.ts:235 Extension Host
extensionHost.ts:236 Debugger listening on ws://127.0.0.1:65352/8dd1261d-3e1b-46fa-95cc-1cad6f5fd490
For help see https://nodejs.org/en/docs/inspector

log.ts:157  INFO no standard startup: not a new window
console.ts:134 [Extension Host] [UriError]: Scheme is missing: {scheme: "", authority: "", path: "", query: "", fragment: ""}
t.log @ console.ts:134
t._logExtensionHostMessage @ extensionHost.ts:453
(anonymous) @ extensionHost.ts:244
emitTwo @ events.js:126
emit @ events.js:214
emit @ internal/child_process.js:772
_combinedTickCallback @ internal/process/next_tick.js:141
_tickCallback @ internal/process/next_tick.js:180
console.ts:134 [Extension Host] Python Extension: Display locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Notify locators are locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Detected refreshing of Interpreters, Arg 1: {}, Return Value: 
console.ts:134 [Extension Host] Python Extension: Display locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Notify locators are locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Detected refreshing of Interpreters, Arg 1: {}, Return Value: 
console.ts:134 [Extension Host] Python Extension: Display locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Notify locators are locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Detected refreshing of Interpreters, Arg 1: {}, Return Value: 
console.ts:134 [Extension Host] Python Extension: Display locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Notify locators are locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Detected refreshing of Interpreters, Arg 1: {}, Return Value: 
console.ts:134 [Extension Host] Python Extension: Create file systemwatcher with pattern */python
console.ts:134 [Extension Host] Python Extension: Create file systemwatcher with pattern */*/python
console.ts:134 [Extension Host] Python Extension: Display locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Notify locators are locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Detected refreshing of Interpreters, Arg 1: {}, Return Value: 
console.ts:134 [Extension Host] Python Extension: Display locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Notify locators are locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Detected refreshing of Interpreters, Arg 1: {}, Return Value: 
console.ts:134 [Extension Host] Python Extension: Display locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Notify locators are locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Detected refreshing of Interpreters, Arg 1: {}, Return Value: 
console.ts:134 [Extension Host] Python Extension: Register Intepreter Watcher, Arg 1: {"$mid":1,"fsPath":"/Users/kai/Dropbox/SCRATCH/fastai","external":"file:///Users/kai/Dropbox/SCRATCH/fastai","path":"/Users/kai/Dropbox/SCRATCH/fastai","scheme":"file"}, Return Value: 
console.ts:134 [Extension Host] Python Extension: Create file systemwatcher with pattern */python
console.ts:134 [Extension Host] Python Extension: Create file systemwatcher with pattern */*/python
console.ts:134 [Extension Host] Python Extension: Display locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Notify locators are locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Detected refreshing of Interpreters, Arg 1: {}, Return Value: 
console.ts:134 [Extension Host] Python Extension: Build the workspace interpreter watcher, Arg 1: {"$mid":1,"fsPath":"/Users/kai/Dropbox/SCRATCH/fastai","external":"file:///Users/kai/Dropbox/SCRATCH/fastai","path":"/Users/kai/Dropbox/SCRATCH/fastai","scheme":"file"}, Return Value: UNABLE TO DETERMINE VALUE
console.ts:134 [Extension Host] Python Extension: Register Intepreter Watcher, Arg 1: undefined, Return Value: 
console.ts:134 [Extension Host] Python Extension: Build the workspace interpreter watcher, Arg 1: undefined, Return Value: UNABLE TO DETERMINE VALUE
console.ts:134 [Extension Host] Python Extension: Get Platform Version, , Return Value: {"raw":"18.2.0","major":18,"minor":2,"patch":0,"prerelease":[],"build":[],"version":"18.2.0"}
console.ts:134 [Extension Host] Python Extension: Get language server folder name, , Return Value: "languageServer.0.1.72"
console.ts:134 [Extension Host] Python Extension: Hide locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: All locators have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Hide locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: All locators have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Hide locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: All locators have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Hide locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: All locators have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Hide locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: All locators have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Hide locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: All locators have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Hide locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: All locators have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Hide locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: All locators have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
bug

Most helpful comment

For me (OP) it's definitely stable memory, high CPU. #479 seems very similar.

All 11 comments

This project hits a debug assertion:

---- DEBUG ASSERTION FAILED ----
---- Assert Short Message ----
Hash code changed when merging AnalysisValues
---- Assert Long Message ----

   at Microsoft.PythonTools.Analysis.AnalysisSetDetails.AnalysisHashSet.AddOne(BucketSet& buckets, AnalysisValue key, Int32 hc, IEqualityComparer`1 comparer) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\AnalysisHashSet.cs:line 425
   at Microsoft.PythonTools.Analysis.AnalysisSetDetails.AnalysisHashSet.AddOne(BucketSet& buckets, AnalysisValue key, IEqualityComparer`1 comparer) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\AnalysisHashSet.cs:line 329
   at Microsoft.PythonTools.Analysis.AnalysisSetDetails.AnalysisHashSet.AddFromEnumerator(BucketSet& buckets, IEnumerator`1 items, IEqualityComparer`1 comparer) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\AnalysisHashSet.cs:line 240
   at Microsoft.PythonTools.Analysis.AnalysisSetDetails.AnalysisHashSet.AddFromEnumerator(IEnumerator`1 items) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\AnalysisHashSet.cs:line 232
   at Microsoft.PythonTools.Analysis.AnalysisSetDetails.AnalysisHashSet..ctor(IEnumerable`1 enumerable, IEqualityComparer`1 comparer) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\AnalysisHashSet.cs:line 85
   at Microsoft.PythonTools.Analysis.AnalysisSet.AsUnion(IAnalysisSet set, UnionComparer comparer, Boolean& wasChanged) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\AnalysisSet.cs:line 288
   at Microsoft.PythonTools.Analysis.AnalysisSet.AsUnion(IAnalysisSet set, Int32 strength, Boolean& wasChanged) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\AnalysisSet.cs:line 247
   at Microsoft.PythonTools.Analysis.AnalysisSet.AsUnion(IAnalysisSet set, Int32 strength) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\AnalysisSet.cs:line 228
   at Microsoft.PythonTools.Analysis.AnalysisSet.AsStrongerUnion(IAnalysisSet set) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\AnalysisSet.cs:line 214
   at Microsoft.PythonTools.Analysis.Values.ArgumentSet.ReduceArgs(IAnalysisSet args, Int32 limit) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Values\ArgumentSet.cs:line 178
   at Microsoft.PythonTools.Analysis.Values.ArgumentSet.FromArgs(FunctionDefinition node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgs) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Values\ArgumentSet.cs:line 166
   at Microsoft.PythonTools.Analysis.Values.FunctionInfo.Call(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Values\FunctionInfo.cs:line 92
   at Microsoft.PythonTools.Analysis.Values.BoundMethodInfo.Call(Node node, AnalysisUnit unit, IAnalysisSet[] args, NameExpression[] keywordArgNames) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Values\BoundMethodInfo.cs:line 37
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateCall(ExpressionEvaluator ee, Node node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\ExpressionEvaluator.cs:line 389
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateWorker(Node node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\ExpressionEvaluator.cs:line 222
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.Evaluate(Expression node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\ExpressionEvaluator.cs:line 55
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateMember(ExpressionEvaluator ee, Node node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\ExpressionEvaluator.cs:line 296
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateWorker(Node node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\ExpressionEvaluator.cs:line 222
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.Evaluate(Expression node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\ExpressionEvaluator.cs:line 55
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateCall(ExpressionEvaluator ee, Node node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\ExpressionEvaluator.cs:line 384
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateWorker(Node node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\ExpressionEvaluator.cs:line 222
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.Evaluate(Expression node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\ExpressionEvaluator.cs:line 55
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateMember(ExpressionEvaluator ee, Node node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\ExpressionEvaluator.cs:line 296
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateWorker(Node node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\ExpressionEvaluator.cs:line 222
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.Evaluate(Expression node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\ExpressionEvaluator.cs:line 55
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateCall(ExpressionEvaluator ee, Node node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\ExpressionEvaluator.cs:line 384
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateWorker(Node node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\ExpressionEvaluator.cs:line 222
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.Evaluate(Expression node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\ExpressionEvaluator.cs:line 55
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateParenthesis(ExpressionEvaluator ee, Node node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\ExpressionEvaluator.cs:line 275
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateWorker(Node node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\ExpressionEvaluator.cs:line 222
   at Microsoft.PythonTools.Analysis.Analyzer.ExpressionEvaluator.Evaluate(Expression node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\ExpressionEvaluator.cs:line 55
   at Microsoft.PythonTools.Analysis.Analyzer.DDG.Walk(AssignmentStatement node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\DDG.cs:line 142
   at Microsoft.PythonTools.Parsing.Ast.AssignmentStatement.Walk(PythonWalker walker) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Parsing\Ast\AssignmentStatement.cs:line 41
   at Microsoft.PythonTools.Analysis.Analyzer.DDG.Walk(SuiteStatement node) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\DDG.cs:line 638
   at Microsoft.PythonTools.Parsing.Ast.SuiteStatement.Walk(PythonWalker walker) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Parsing\Ast\SuiteStatement.cs:line 34
   at Microsoft.PythonTools.Analysis.Analyzer.FunctionAnalysisUnit.AnalyzeWorker(DDG ddg, CancellationToken cancel) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\FunctionAnalysisUnit.cs:line 88
   at Microsoft.PythonTools.Analysis.AnalysisUnit.Analyze(DDG ddg, CancellationToken cancel) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\AnalysisUnit.cs:line 139
   at Microsoft.PythonTools.Analysis.Analyzer.DDG.Analyze(Deque`1 queue, CancellationToken cancel, Action`1 reportQueueSize, Int32 reportQueueInterval) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Analyzer\DDG.cs:line 78
   at Microsoft.PythonTools.Analysis.PythonAnalyzer.AnalyzeQueuedEntries(CancellationToken cancel) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\PythonAnalyzer.cs:line 791
   at Microsoft.PythonTools.Intellisense.AnalysisQueue.GroupAnalysis.Analyze(CancellationToken cancel) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Intellisense\AnalysisQueue.cs:line 229
   at Microsoft.PythonTools.Intellisense.AnalysisQueue.HandleAnalyzable(IAnalyzable item, AnalysisPriority priority, CancellationToken cancellationToken) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Intellisense\AnalysisQueue.cs:line 152
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.PythonTools.Intellisense.AnalysisQueue.HandleAnalyzable(IAnalyzable item, AnalysisPriority priority, CancellationToken cancellationToken)
   at Microsoft.PythonTools.Intellisense.AnalysisQueue.<>c__DisplayClass31_0.<Enqueue>b__0(CancellationToken ct) in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Intellisense\AnalysisQueue.cs:line 136
   at Microsoft.PythonTools.Intellisense.AnalysisQueue.ConsumerLoop() in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Intellisense\AnalysisQueue.cs:line 64
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.<>c.<OutputWaitEtwEvents>b__12_0(Action innerContinuation, Task innerTask)
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(TResult result)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetResult(TResult result)
   at Microsoft.PythonTools.Intellisense.AnalysisQueue.ConsumeAsync() in C:\Users\jabaile\python-language-server\src\Analysis\Engine\Impl\Intellisense\AnalysisQueue.cs:line 89
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.<>c.<OutputWaitEtwEvents>b__12_0(Action innerContinuation, Task innerTask)
   at System.Threading.Tasks.AwaitTaskContinuation.ExecuteWorkItemHelper()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

key shows as Class NoneType, existingKey shows as type, and newKey shows as None. The thing being analyzed seems to be fastai.tabular.data.from_df.

This means instance comparer said new object is the same as one in the hash set but calculated hash codes did not match. Debug only, in release it basically just adds new object. Check what compares types and why hash code comes out different.

Disabling that check to see what it would do in release mode reproduces the "memory usage doesn't change, but CPU stays at 100% of a core". Seems like it's all being done here:

image

One thing I'm seeing is that this project imports typing stuff indirectly through * imports of other files.

I have similar problem on my Win 10 laptop (16 GB) with latest versions of everything (Anaconda/Python, VS Code, Visual Studio IntelliCode -Preview, ...). Python.Language.Server eventually consumes all available memory at the rate of approx. 500 MB/min.

Steps to reproduce:

  1. Create folder
  2. Open VS Code there
  3. In VS Code create file test.py, don't type anything
  4. Wait a couple of minutes, while looking at the memory consumption of Microsoft.Python.Language.Server.exe in Task Manager. Memory used by language server stays around 160-180 MB, which is very ok.
  5. Type import pandas to your test.py file, then wait a little
  6. Language server starts consuming memory 500 MB/min, with 30-50% of CPU.

Same behaviour happens also with other libraries. Because of this I can't use the Intellicode (Preview) feature, but have to revert back to Jedi.

The original issue in this thread seems to be more in the vein of "stable memory, high CPU with no progress". Your issue seems closer to #450.

Also related to this issue is the (older) #479, which seems to have the same symptoms as the OP.

For me (OP) it's definitely stable memory, high CPU. #479 seems very similar.

@KaiLicht I observed a similar problem on the scikit-learn repo.

Here is the section of my settings to use the beta version of the language server with VS code and get trace level debug output in the "Python" output view.

{ 
   "python.analysis.logLevel": "Trace",
   "python.analysis.downloadChannel": "beta",
   "python.jediEnabled": false
}

Around 400MB, ~20 sec.
image

0.2.16 is now available on beta channel.

"python.analysis.downloadChannel": "beta"

really promising after upgrade to this beta version.

Was this page helpful?
0 / 5 - 0 ratings