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.

venvPath starting with tilde causes 100% CPU usage on Apple Silicon

See original GitHub issue

Environment data

  • VS Code version: 1.54.3 (Universal)
  • Extension version (available under the Extensions sidebar): v2021.3.680753044
  • OS and version: macOS 11.2.3 (Apple Silicon) - Darwin arm64 20.3.0
  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.2 (homebrew)
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): venv
  • Relevant/affected Python packages and their versions:
  • Relevant/affected Python-related VS Code extensions and their versions:
  • Value of the python.languageServer setting: Pylance (but disabling didn’t matter)

Expected behaviour

Editing Python files without using 100% CPU.

Actual behaviour

When python.venvPath is set to a string starting with “~” (~/Documents/Environments in my case), opening any Python file causes a “Code Helper (Renderer)” process to use 100% CPU, and persists after closing the file (until the whole window is closed). The interpreter selector also does not show all the environments in that directory as it normally would. Interestingly, this only seems to happen on my Apple Silicon mac, not my Intel mac.

Steps to reproduce:

  1. Make sure you’re on an Apple Silicon mac
  2. mkdir -p ~/Documents/Environments
  3. python3 -m venv ~/Documents/Environments/myenv
  4. Set python.venvPath to ~/Documents/Environments
  5. Open a python file and check Activity Monitor or top; check for myenv in interpreter selector
  6. Replace ~ with /Users/whatever and restart VSCode
  7. Open a python file and see normal CPU usage

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
karthiknadigcommented, Mar 29, 2021

@scotchneat Orphaned processes issue should be addressed in the insiders version of the extension. Python extension activation in non python projects is due to this https://github.com/microsoft/vscode-jupyter/issues/5193

We think we know the cause of the ~ issue. We marked this as P1 and should get addressed in the april release.

1reaction
dcwatsoncommented, Mar 26, 2021

FWIW, opting out of pythonDiscoveryModule and leaving python.venvPath prefixed with ~ also fixed the problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

venvPath starting with tilde causes 100% CPU usage ... - GitHub
venvPath starting with tilde causes 100 % CPU usage on Apple Silicon # ... Interestingly, this only seems to happen on my Apple...
Read more >
High CPU usage on M1 - Apple Support Communities
High CPU usage on M1 ... Start up a Mac with Apple silicon in safe mode. On your Mac, choose Apple menu >...
Read more >
sudden high cpu usage with google chrome - Apple Community
Web pages, whether using Chrome, Safari or another browser often go rogue and start consuming too much resources for no apparent reason. You ......
Read more >
Kernel task hogging CPU - Apple Community
The Kernel task's CPU usage is fluctuating between around 3% to as high at 6,000% at times, but mostly hovering between 100-800%.
Read more >
With upgrade to Monterey 12.3 - process "… - Apple Community
Then, try restarting the Mac as normal, and see if it still has a high CPU usage.
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