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.exe eating all RAM and lots of CPU.

See original GitHub issue

Hi.

The Microsoft.Python.LanguageServer.exe is eating up all my memory. It goes all the way to 12 gigs, then drops down to 1gb, then climbs again, constantly.

I had this problem a week or two ago and it was cured by installing an ms-python-insiders.vsix manually. I think it’s updated itself and broken again.

I have tried python insiders extension, as well as the 2018.9 that is available from the side bar. I’ve also tried both with VSCode stable, as well as VSCode insiders.

Also “python.analysis.watchSearchPaths” : “false” has made no difference

My PC is going very slow and it’s swapping all over my SSD.

Any ideas?

Environment data

  • VS Code version: 1.29.0-insider
  • Extension version (available under the Extensions sidebar): 2018.9.0 and 2018.10-alpha
  • OS and version: Windows 10 Pro 1803
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.7.0 x64
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): virtualenv
  • Relevant/affected Python packages and their versions: Django 2.1@master branch

Actual behavior

Computer runs slowly.

Expected behavior

Computer works at a reasonable speed and doesn’t get hot and slow and waste away my SSD.

Steps to reproduce:

  1. Open up VSCode and open up a .py file from the django project

Logs

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

Starting Microsoft Python language server.
Microsoft Python Language Server version 0.1.42.0
Initializing for C:\Users\CarlFarrington\envs\hrr\Scripts\python.exe
##########Linting Output - pylint##########
************* Module riskreg.serializers
21,0,convention,C0304:Final newline missing
1,0,convention,C0111:Missing module docstring
5,0,convention,C0111:Missing class docstring
16,0,convention,C0111:Missing class docstring
3,0,warning,W0611:Unused Agent imported from models
3,0,warning,W0611:Unused Owner imported from models
3,0,warning,W0611:Unused Ownergroup imported from models

------------------------------------------------------------------

Your code has been rated at 5.00/10 (previous run: 5.00/10, +0.00)

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

/C:/Program Files/Microsoft VS Code Insiders/resources/app/out/vs/workbench/workbench.main.js:1410  INFO no standard startup: not just one text editor
/C:/Program Files/Microsoft VS Code Insiders/resources/app/out/vs/workbench/workbench.main.js:280 [Extension Host] Python Extension: Get language server folder name, , Return Value: "languageServer.0.1.42" (at Logger.logInformation (C:\Users\CarlFarrington\.vscode-insiders\extensions\ms-python.python-2018.9.0\out\client\common\logger.js:35:21))

image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:26 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
jakebaileycommented, Oct 22, 2018

This should be fixed via Microsoft/python-language-server#280 (reported Microsoft/python-language-server#278).

It’s not in the stable release channel yet, but you can pull our latest language server daily build by setting "python.analysis.downloadChannel": "daily" in your settings JSON and reloading. Note that this is undocumented and for testing only. There may be other bugs in our daily builds which don’t appear in stable. You may need to delete the languageServer directories in the Python extension folder to return to the stable build after trying it out, as the extension will always select the newest downloaded version to start.

1reaction
jarshwahcommented, Nov 15, 2018

I’ve followed debugging tips for getting the latest language server:

Language Server Version: 0.1.62

I’m still seeing 1 CPU pegged at 100%, and RAM constantly climbing. After looking at AnalysisLog.txt in the language server directory of the extension, I’m seeing thousands of lines like this:

[00:01:43.3652700] ImportNotFound: k3.orders.tests.k3
[00:01:43.3652910] ImportNotFound: k3.orders.tests.tests
[00:01:43.3674490] ImportNotFound: images.tests.mock
[00:01:43.3675020] ImportNotFound: images.tests.django
[00:01:43.3675220] ImportNotFound: images.tests.images
[00:01:43.3675490] ImportNotFound: images.tests.tests
[00:01:43.3680130] ImportNotFound: ge.tests.copy
[00:01:43.3680260] ImportNotFound: ge.tests.django
[00:01:43.3680440] ImportNotFound: ge.tests.ge
[00:01:43.3680620] ImportNotFound: ge.tests.tests
[00:01:43.3683680] ImportNotFound: k3.products.tests.models.datetime
[00:01:43.3684220] ImportNotFound: k3.products.tests.models.django
[00:01:43.3684660] ImportNotFound: k3.products.tests.models.django

I thought this might have something to do with the root paths (because the final component of the import path above was missing in previous language server version logs - (after) ge.tests.ge -> ge.tests (before)).

My project is workspace/kogan3/ with my workspace/kogan3/apps directory added as a top level import by inserting it into sys.path from manage.py. I tell vscode-python about this like so:

"python.autoComplete.extraPaths": [
        "${workspaceRoot}/kogan3/apps/",
        "${workspaceRoot}/kogan3/",
    ],

I should note this is a python2.7 project, and I’m guessing the weird imports are due to absolute import differences, but I’m just guessing at this stage.

Since AnalysisLog was constantly being written to, I figured this might be the cause for my 100% cpu, but I didn’t know whether it was the use of the language server from the extension, or the server itself. Happy to repost over on the language server repo.

In fact, my cpu usage has just dropped down to a reasonable level (near 0 while I’m not actively using the editor) after the update to the latest server. It was pegged at 100% for over 10 minutes though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lsass.exe consuming high CPU usage in web server with ...
The server has 3 ASP.Net domains and one Wordpress domain. The CPU and RAM configuration are: Server 1: 8 GB RAM, 2 vCPU,...
Read more >
Visual Studio Code took 10.7 GB RAM usage after using it for ...
The solution is to go to settings and enable jedi. The culprit that was consuming excessive RAM was Python language server. So, by...
Read more >
Visual Studio Code Consumpt high CPU while typing
Now I start next.js project my CPU use 30-40% only if I typing in Visual Studio Code I think it is not normal....
Read more >
vs code jedi language server is running over 120.9% of CPU ...
Python by itself doesn't really consume any CPU. A program using python3 is misbehaving and consuming too many resources.
Read more >
Pylance consuming too much memory, how to enable Jedi to ...
My Pylance when I leave my VSCode running a Python file , every few minutes the number of ram memory used increases, reaching...
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