-
Notifications
You must be signed in to change notification settings - Fork 133
Python Language Server uses too much CPU #479
Comments
On #3653 (duplicate) Just in case the differences matter: I'll have to check on CPU use, but I didn't notice it. I'd guess it's usually reasonable, even when memory use 10GB or higher (most of the time). I'm on Python 3 not 2, and have only that version of Python installed. |
I have couple projects. On python3 is ok. But on python2 cpu usage skips to 100%. Language Server: 0.1.65 Python output, Extension Output, etc. Is empty, no error messages |
Most probably similar to #495 |
i can repro this:
|
FWIW I have the same behavior on python3.7 on the xarray repo I've tried both the current release and the daily channel ( |
Seems like I'm running into the same issue with scikit-learn. 100% and minimal RAM. |
To all folks: we made some tactical fixes, but there is inherent issue to the analysis engine approach. We are currently working on major restructuring of the static analysis engine that should address the issue with both CPU and memory. If you install Zenhub extension to Chrome, you should be able to track epic #425. The work is not trivial and is not a bug fix level change. WIP PR #465. Thanks you for using the LS, the feedback is much appreciated. |
Just as a simple not-so-workaround, how about assigning a lower priority to the spawned process? On Linux all processes have a value called By doing this very simple patch, we don't fix the CPU leak, but at least we tell the CPU to not block more important processes just for the sake of keep running the language server. Basically, the users wouldn't notice so much this leak. And in any case, it's a good practice for background processes. I usually I bet other OS have a similar system. |
That might be possible. Given this is in C#, we can do: Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal; Which has the effect of setting the nice to 10 on Unix-y platforms. |
On second thought, it seems like that'd only help in cases where the system is already using all of its cores at once. If the system has a free core to schedule the process on, it's going to do that even if the nice value is high. I'm not sure that would affect other processes if there are already free cycles... |
|
Not sure if you're able to reproduce this issue still or not, I'm happy to provide some log/debug info OS: macOS 10.14.2 The virutalenv has a large number of dependencies (pyside2, numpy, scipy, pandas..); the codebase isn't particularly large. Python is the only extension currently installed (debug step was to remove VSCode entirely and try again). Below is everything I could think of as being relevant, but if there is something else that would be helpful, let me know. User Settings {
"python.jediEnabled": false,
"python.analysis.logLevel": "Trace",
"python.formatting.provider": "black"
} workplace settings: {
"python.linting.flake8Enabled": true,
"python.linting.flake8Path": ".venv/bin/flake8",
"python.linting.flake8Args": ["--config=setup.cfg"],
"python.linting.pylintEnabled": false,
"python.unitTest.pyTestEnabled": true,
"python.unitTest.pyTestPath": ".venv/bin/pytest",
"python.formatting.blackPath": ".venv/bin/black",
"python.pythonPath": ".venv/bin/python",
"python.sortImports.path": ".venv/bin/isort",
"python.sortImports.args": ["--settings-path ./pyproject.toml"]
} View -> Output -> Python
Log (Extension host)
Log (Window)
Log (Shared)
Log (Main)
EDIT: Let my machine run over the weekend; still running at ~100% CPU |
OS: macOS 10.14.2 I'm having a similar issue on my MBP, where Microsoft.Python.LanguageServer is running up to 100%+ CPU usage when I have large Python projects open (one, in particular, is ~200MB) within a virtual environment. I have tested this with both Python 3.6.7 (from the official website), Python 2.7.15 (installed from Brew and another that's native to Mac). All versions in the virtual environment exhibit similar behavior. I have this Very frustrating, as my CPU is normal when I use Atom or PyCharm with the same project. Please let me know if I can help in any way to try and get to the bottom of this. |
Please see this comment above: #479 (comment) The story hasn't changed; it's still being worked on. See here for specific issues: https://github.com/Microsoft/python-language-server/issues?q=label%3AGA (I also responded in the other thread you commented on). |
Please forgive me for commenting on a closed issue. Congratulations on that pull request, that looks like a ton of work went into this, thank you. I am curious if you know know what version of the Language Server will incorporate that pull request or when it will go live? Thanks again for this awesome tool. |
If you install Zenhub extension to Chrome, you should be able to see our schedule. Specifically, the Release report. |
I am also have the same problem with the following version |
this sucks !!! |
It is exceptional to see so badly managing resource piece of software in production with known bugs (and/or bad design) since months and still not fixed. Not sure what it is wrong the management of the project or people working on this project or the testing, but it is very difficult for users of VS Code (Python on Mac...) to trust the capacity of Microsoft to produce good quality software. What is the required hardware capacity to run VS Code with Python (on Mac)? 70 GiB RAM for VS Code? |
This is not normal, it is a bug. We have been working for many weeks on performance improvements, including memory usage. At the latest revision, analyzing tensorflow on my machine only uses 400 MB, as opposed to the multiple gigabytes it used to take. If you have a project which reproduces it, we'd love to test it and figure out why that would occur. Also, try switching up to the beta release, which has many more improvements not yet in stable. "python.analysis.downloadChannel": "beta" |
@jakebailey I understand that this is a bug, I'm happy to see that you are working on fixing it, but the problem of abusive usage of resources is not new. This ticket is more six months old, and there was other as well earlier Q4 last year. I'm surprised that it is taking you more than six months to fix it, plus have the feeling that is going backward not reducing the resources used but increasingly. 20-40 GB was the "normal" level a few months ago, and now it is 70 GB. I hope that soon you will fix it, and not again add small patches that solve few loading pick issues. The hidden requirement to restart many times per day VS Code reminds me of the old times of Windows. |
Analyzing workspace of Microsoft.Python.LanguageServer at the early start of opening, is a killing resources machines, is just like a python surrounding your neck, iI disabled other extensions, Jedi False, and the server just takes all available resources as a desperately hungry that just return from the jungle ... Please let me know if you have some tips, tricks or guidance to resolve or how we can help to resolve this. |
Reading related reports issues, and testing, I got an improvement that helps me a few. "python.analysis.logLevel": "Trace", |
Thank you for the work on python language server. I am a happy user of vscode, but when it comes to python code in my project, I have to switch to sublime etc., because python package is bundled together with language server (I might be wrong), and now I also have this issue of very high cpu usage, (I have relative faster macbook air with i7 processor)... Is it possible to separate the python extension and python language server? |
You can disable the language server by setting |
You can't use Jedi with IntelliCode; IntelliCode's Python support is an extension to the language server. That gear button may offer a way, but past that I do not know other than to remove IntelliCode. Be aware that we've just built 0.3.22, which is available in the beta/daily channels. It contains some fixes which can help. You can set this and reload to update:
|
@VelizarVESSELINOV commented on Tue Dec 04 2018
Environment data
Expected behaviour
< 1% CPU
Actual behaviour
> 99% CPU
Steps to reproduce:
Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)@brettcannon commented on Wed Dec 05 2018
Do you have
"python.autoComplete.extraPaths"
defined?@PushUpek commented on Thu Dec 06 2018
I have the same issue, but only with python2
@VelizarVESSELINOV commented on Thu Dec 06 2018
@brettcannon only in the default user settings defined as
[]
@VelizarVESSELINOV commented on Thu Dec 06 2018
It is the biggest CPU consumer of all the processes: >21 hours
Side comment that maybe it is the case of @PushUpek I have a lot of files and folders in my current folder that is not Python code or libraries, questioning if Microsoft Python Server is not trying to parse GiB of data continuously in the current folder of VS Code project.
@jonaswitt commented on Mon Dec 10 2018
+1 - I have the same problem with
VS Code 1.29.1
Microsoft Python Language Server version 0.1.65.0
Python Extension 2018.11.0
Python 2.7.15 (venv-based environment)
My
python.autoComplete.extraPaths
setting is also[]
. I tried to disable Jedi and Linting. I keep killing the process to keep my Macbook's fans from spinning, but it always respawns at 100% CPU usage.Is there any way to disable the language server? I believe my only option right now is to disable the python extension completely.
@dwt commented on Mon Dec 10 2018
This happens for me too. Python 2.7 with a moderately big project. What Info can I provide to help debug this?
The text was updated successfully, but these errors were encountered: