question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Microsoft.Python.LanguageServer excessive resource usage

See original GitHub issue

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 (ViewOutput, 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: 

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:18 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
keyunjie96commented, Apr 7, 2019

Is there any chances that this is caused due to security software? (Like antivirus, enterprise Windows, etc)

Not only on Windows, but Mac users also suffer from the Python Language Server.

2reactions
kazbeelcommented, Jun 28, 2019

I have created a very simple Python project just to make some tests. And after some time, I can confirm that I only have memory leaks when pointing to a Virtual Environment. At the right moment I change the “python.pythonPath” to the system’s python executable, the memory leak disappears.

I have only tested on Windows.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Microsoft.Python.LanguageServer excessive resource usage
Microsoft.Python.LanguageServer is using a reasonable amount of ressources. Actual behaviour. Microsoft.Python.LanguageServer is using 100%+ CPU ...
Read more >
Language Server Extension Guide - Visual Studio Code
As language analysis tools are often heavy on CPU and Memory usage, running them in separate process avoids performance cost. Here is an...
Read more >
Quickstart: Create ARM templates with Visual Studio Code
Use Visual Studio Code and the Azure Resource Manager tools extension to work on Azure Resource Manager templates (ARM templates).
Read more >
Add a Language Server Protocol extension
Learn how to create a Visual Studio extension that integrates a language server based on the Language Server Protocol (LSP).
Read more >
Python in Visual Studio Code – September 2021 Release
An update regarding the Microsoft Python Language Server's end of life, as well as for Python 2.7 IntelliSense support. If you're interested, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found