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.

Rogue Python Processes with High CPU Consumption

See original GitHub issue

Opening python (.py) files in Visual Studio Code (VSC) resulted in rogue python3.8 processes that did not terminate after closing the files or quitting VSC. The processes consumed over 81% of the CPU and were associated with rapid loss of battery power on a MacBook Air (M1, 2020). This was repeatable with an empty file with a .py extension.

Steps to Reproduce the Problem

. Started VSC without any installed extensions. . Opened existing emptyfile.py file with no content. . No python3.8 processes running. . Closed emptyfile.py file. . Closed VSC window. . Quit VSC. . No python3.8 processes running. . Opened VSC. . Installed Python extension. This also installed jupyter extension. . No python3.8 processes running. . Opened emptyfile.py file. . Checked for python processes:

% ps -ax | grep python
 4286 ??         0:00.27 /Users/Scott/anaconda3/bin/python /Users/Scott/.vscode/extensions/ms-python.python-2021.2.625869727/pythonFiles/runJediLanguageServer.py
 4299 ??         0:00.15 /Users/Scott/anaconda3/bin/python /Users/Scott/anaconda3/lib/python3.8/site-packages/jedi/inference/compiled/subprocess/__main__.py /Users/Scott/anaconda3/lib/python3.8/site-packages 3.8.5 

. CPU use around 5%

. Closed emptyfile.py file. . The two processes from ps above still present. . Closed VSC window. . python3.8 processes, PID 4286, now using about 81% CPU. . Quit VSC. . python3.8 processes, PID 4286, still using about 81% CPU. . Process, PID 4289, from above ps still running. . kill 4286 from terminal. . Processes, PIDs 4286 and 4299, from above ps, no longer present. . CPU use back down to around 6%.

Configuration

Visual Studio Code Version: 1.54.1 Commit: f30a9b73e8ffc278e71575118b6bf568f04587c8 Date: 2021-03-04T22:42:18.719Z (19 hrs ago) Electron: 11.3.0 Chrome: 87.0.4280.141 Node.js: 12.18.3 V8: 8.7.220.31-electron.0 OS: Darwin x64 20.3.0

Model Name: MacBook Air Model Identifier: MacBookAir10,1 Chip: Apple M1 Memory: 16 GB System Firmware Version: 6723.81.1

System Software Overview: System Version: macOS 11.2.2 (20D80) Kernel Version: Darwin 20.3.0

Python 3.8.5

VSC Extensions

Python ms-python.python v2021.2.625869727

Jupyter ms-toolsai.jupyter Microsoft 10,388,239 Repository License v2021.3.619093157

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:16
  • Comments:55 (25 by maintainers)

github_iconTop GitHub Comments

31reactions
luabudcommented, Mar 7, 2021

Thanks for giving this info! I think the problem may be one of our new features, can you try disabling it by following the steps below, and see if that fixes the problem you’re experiencing?

  1. Open the command palette (View > Command Palette…)
  2. Run the “Preferences: Open Settings (JSON)” command. This will open the user settings in VS code
  3. Paste the following line in the settings file:
"python.experiments.optOutFrom": ["pythonJediLSP"]
  1. Reload the window (either by closing VS Code and opening it again or running the “Developer: Reload Window” command from the command palette)
4reactions
zcott11commented, Mar 8, 2021

The problem no longer occurs after following the steps outlined by luabud, which added
“python.experiments.optOutFrom”: [“pythonJediLSP”], to settings.json.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Runaway Jedi Language task in VSCode - Stack Overflow
reference: Rogue Python Processes with High CPU Consumption issue #15586 ... We can use different python language services: Jedi , Microsoft ...
Read more >
How to find which integration is causing high CPU usage?
There is one Python thread that is using a very high amount of CPU. As consequence, my RPi is running constantly hot, and...
Read more >
Python process has 100% CPU usage and can't be stopped
I have a python process running on a CentOS machine. I the process is running with 100% CPU usage and status 'R'.
Read more >
Dynatrace AI: In Action Rogue Python Script Impacting ...
Dynatrace OneAgent automatically monitors all processes – including the ones consuming all the CPU! Duplicity runs on every of Addteq's hosts but only...
Read more >
Tips for top: Monitoring CPU load on Linux - Opensource.com
Where should you look for answers? The top program is a great place to start. It can give you a rich, self-updating overview...
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