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.

High CPU usage with Jedi and MPLS

See original GitHub issue

I’m still experiencing this issue: https://github.com/microsoft/vscode-python/issues/10263

It’s making this plugin completely unusable.

Environment data

  • VS Code version: 1.44.2
  • Extension version (available under the Extensions sidebar): 2020.5.80290
  • OS and version: Mac OSX 10.15.1
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.3
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): venv
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info #3977): Jedi Enabled = True
  • Value of the python.languageServer setting: Microsoft

Expected behaviour

The plugin takes an undetectable amount of CPU capacity. I can open many tabs of python code. Tests run in a minute or two and don’t make the fan run or slow down the laptop.

Actual behaviour

Enabling the plugin and running tests spawns many python threads that use 100% of CPU capacity. Tests take 10+ minutes. The fan runs. Everything on the laptop slows down.

CPU usage appears to possibly be correlated to the number of tabs open.

Steps to reproduce:

  1. Enable the plugin.
  2. Open several tabs of python code.
  3. Run tests with the test explorer.
  4. Observe CPU usage.

With VS Code open, plugin disabled, no tabs open: image

After opening 10 tabs: image

After enabling plugin and reloading (no tabs open): image

After opening 10 tabs with plugin enabled: image

After starting tests with the test explorer: image

After completing tests: image

CPU usage stays maxed out even after the tests are done.

Logs

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

User belongs to experiment group 'ShowPlayIcon - start'
User belongs to experiment group 'DebugAdapterFactory - experiment'
User belongs to experiment group 'PtvsdWheels37 - experiment'
User belongs to experiment group 'LS - control'
User belongs to experiment group 'UseTerminalToGetActivatedEnvVars - control'
User belongs to experiment group 'WebHostNotebook - control'
User belongs to experiment group 'LocalZMQKernel - control'
User belongs to experiment group 'NativeNotebook - control'
User belongs to experiment group 'CollectLSRequestTiming - control'
User belongs to experiment group 'CollectNodeLSRequestTiming - experiment'
User belongs to experiment group 'EnableIPyWidgets - experiment'
User belongs to experiment group 'RunByLine - control'
> conda --version
> pyenv root
> python3.7 ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3.6 ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3 ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python2 ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> conda info --json
> ~/mypackage/venv/bin/python ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
Starting Jedi Python language engine.
Python interpreter path: ~/mypackage/venv/bin/python
> ~/mypackage/venv/bin/python ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py -c "import notebook"
> ~/mypackage/venv/bin/python ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py -c "import jupyter"
> conda --version
> ~/mypackage/venv/bin/python ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir ~/mypackage/venv/mypackage-data -s --cache-clear
cwd: ~/mypackage/venv/mypackage-data
> ~/mypackage/venv/bin/python ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.prefix)"
cwd: ~/mypackage/venv/mypackage-data
> ~/mypackage/venv/bin/python ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.prefix)"
cwd: ~/mypackage/venv/mypackage-data
> ~/mypackage/venv/bin/python ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
cwd: ~/mypackage/venv/mypackage-data
> ~/mypackage/venv/bin/python ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
cwd: ~/mypackage/venv/mypackage-data
> ~/mypackage/venv/bin/python ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/mypackage/venv/mypackage-data
> ~/mypackage/venv/bin/python ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/mypackage/venv/mypackage-data
> ~/mypackage/venv/bin/python ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py site --user-site
cwd: ~/mypackage/venv/mypackage-data
> ~/mypackage/venv/bin/python ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py site --user-site
cwd: ~/mypackage/venv/mypackage-data
> ~/mypackage/venv/bin/python ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py jupyter kernelspec --version
> ~/mypackage/venv/bin/python ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/completion.py
> ~/mypackage/venv/bin/python ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/completion.py
> ~/mypackage/venv/bin/python ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py flake8 --format=%(row)d,%(col)d,%(code).1s,%(code)s:%(text)s ~/mypackage/venv/mypackage-data/mypackage_data/pipe/models.py
cwd: ~/mypackage/venv/mypackage-data
> ~/mypackage/venv/bin/python ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py flake8 --format=%(row)d,%(col)d,%(code).1s,%(code)s:%(text)s ~/mypackage/venv/mypackage-data/mypackage_data/pipe/models.py
cwd: ~/mypackage/venv/mypackage-data
> ~/mypackage/venv/bin/python ~/.vscode/extensions/ms-python.python-2020.5.80290/pythonFiles/pyvsc-run-isolated.py pytest --rootdir ~/mypackage/venv/mypackage-data --junitxml=/var/folders/xp/3xpd2x4j4zsf7vvvzd328cmh0000gn/T/tmp-243b2FToho3FOPs.xml
cwd: ~/mypackage/venv/mypackage-data


Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

XXXX

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
kimadelinecommented, Mar 23, 2021

Hi everyone,

Is this issue still happening with the latest version of the extension?

We have also released a more performant language server called Pylance. You can download it from the marketplace and install it alongside the core Python extension. Feel free to give it a try instead of Jedi or MPLS and see if it helps 🙂

Thank you!

0reactions
kimadelinecommented, Sep 21, 2021

Since this was reported we have replaced our own custom Jedi integration with jedi-language-server, and deprecated the Microsoft option. I will be closing this issue, if you still encounter this problem with this new Jedi or Pylance, please open a new issue, so we can triage it appropriately.

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Holy crap. Jedi Fallen Orders CPU usage is insanely high ...
my CPU usage shot up from 20-25% to 80%+ and my GPU usage dropped. Suddenly, I was CPU limited. I was shocked, my...
Read more >
MPLS and CPU utilization ! - Cisco Community
Hi every1, this query could be a bit long but kindly read it, its very imp. I have a 3845 router running 12.4...
Read more >
neoclide/coc.nvim - Gitter
I am getting this with coc-python installed using jedi installed through pip: ... Set up to 700 but I still get high cpu...
Read more >
Determining Which Process Causes the High CPU Usage
1. The device encounters a hardware fault, which may cause the high CPU usage. 2. A master/slave switchover or board registration is performed,...
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. I use ps command ......
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