High CPU usage with Jedi and MPLS
See original GitHub issueI’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:
- Enable the plugin.
- Open several tabs of python code.
- Run tests with the test explorer.
- Observe CPU usage.
With VS Code open, plugin disabled, no tabs open:
After opening 10 tabs:
After enabling plugin and reloading (no tabs open):
After opening 10 tabs with plugin enabled:
After starting tests with the test explorer:
After completing tests:
CPU usage stays maxed out even after the tests are done.
Logs
Output for Python
in the Output
panel (View
→Output
, 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:
- Created 3 years ago
- Reactions:3
- Comments:12 (2 by maintainers)
Top GitHub Comments
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!
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!