pylance-release
pylance-release copied to clipboard
Pylance extension consistenly uses 100% CPU in macOS
Environment data
- Language Server version: 2022.4.3
- OS and version: macOS 12.3.1
- Python version (& distribution if applicable, e.g. Anaconda): 3.7
Expected behavior
Not use 100% CPU
Actual behavior
Never ending 100% CPU usage
Logs
Code Snippet / Additional information
Downgrading to 2022.3.0 makes the issue go away. It comes back immediately when I switch to 2022.3.1 or later.
thanks for the report. Have you tried using the latest build 2022.4.3? We fixed a couple of issues related to performance.
Please reopen if you still see a problem after updating. thanks
The bug was reported against 2022.4.3, so I think we should reopen.
However, we're going to need much more information to diagnose the problem — preferably a clear set of repro steps. At a minimum, we'll need logs.
@kavehv Can you provide us some logs as described in the troubleshooting guide?
I'm not @kavehv. However, the PyLance process is consuming 100% CPU for me and heating up my M1 macbook, in ways I haven't experienced before. :)
I'm connected to a VSCode Live Share. I don't have conda installed locally, but the person I'm collaborating with does -- and the project has an environment.yml with the contents:
name: flowerpot
channels:
- conda-forge
- defaults
dependencies:
- python=3.10
The trace logs suggest that it's going through my entire filesystem, looking for something?
Trace logs starting with [Info - 10:26:58 PM] (25656) Pylance language server 2022.4.3 (pyright 88f2a424) starting
: https://gist.github.com/pradyunsg/550692e89a9b6982ed60de4e9ab335af
Started a new window with trace enabled from the start and a downgrade, which shows me that it's treating /
as a fswatch path, which seems very wrong.
[Info - 10:37:07 PM] (26528) Pylance language server 2022.3.0 (pyright 1ed262f6) starting
[Info - 10:37:07 PM] (26528) Server root directory: /Users/pradyunsg/.vscode/extensions/ms-python.vscode-pylance-2022.3.0/dist
[Info - 10:37:07 PM] (26528) No configuration file found.
[Info - 10:37:07 PM] (26528) No pyproject.toml file found.
[Info - 10:37:07 PM] (26528) Setting pythonPath for service "flowerpot": "/opt/homebrew/bin/python3"
[Warn - 10:37:07 PM] (26528) stubPath /typings is not a valid directory.
[Info - 10:37:07 PM] (26528) Assuming Python version 3.9
[Info - 10:37:07 PM] (26528) Assuming Python platform Darwin
[Info - 10:37:07 PM] (26528) Search paths for /
[Info - 10:37:07 PM] (26528) /Users/pradyunsg/.vscode/extensions/ms-python.vscode-pylance-2022.3.0/dist/typeshed-fallback/stdlib
[Info - 10:37:07 PM] (26528) /
[Info - 10:37:07 PM] (26528) /typings
[Info - 10:37:07 PM] (26528) /Users/pradyunsg/.vscode/extensions/ms-python.vscode-pylance-2022.3.0/dist/typeshed-fallback/stubs/...
[Info - 10:37:07 PM] (26528) /Users/pradyunsg/.vscode/extensions/ms-python.vscode-pylance-2022.3.0/dist/bundled/stubs
[Info - 10:37:07 PM] (26528) /opt/homebrew/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9
[Info - 10:37:07 PM] (26528) /opt/homebrew/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload
[Info - 10:37:07 PM] (26528) /opt/homebrew/lib/python3.9/site-packages
[Info - 10:37:07 PM] (26528) Adding fs watcher for directories:
/
[Info - 10:37:07 PM] (26528) Searching for source files
[Warn - 10:37:14 PM] (26528) Skipping broken link "/Library/Caches/com.apple.aned"
[Warn - 10:37:15 PM] (26528) Skipping recursive symlink "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Headers/ruby/ruby" -> "/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby"
[Warn - 10:37:15 PM] (26528) Skipping recursive symlink "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby/ruby" -> "/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby"
[Warn - 10:37:15 PM] (26528) Skipping recursive symlink "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/Current/Headers/ruby/ruby" -> "/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby"
[Error - 10:37:17 PM] (26528) Enumeration of workspace source files is taking longer than 10 seconds.
This may be because:
* You have opened your home directory or entire hard drive as a workspace
* Your workspace contains a very large number of directories and files
* Your workspace contains a symlink to a directory with many files
* Your workspace is remote, and file enumeration is slow
To reduce this time, open a workspace directory with fewer files or add a pyrightconfig.json configuration file with an "exclude" section to exclude subdirectories from your workspace. For more details, refer to https://github.com/microsoft/pyright/blob/main/docs/configuration.md.
[Warn - 10:37:18 PM] (26528) Skipping recursive symlink "/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Ruby.framework/Headers/ruby/ruby" -> "/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby"
[Warn - 10:37:18 PM] (26528) Skipping recursive symlink "/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby/ruby" -> "/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby"
[Warn - 10:37:18 PM] (26528) Skipping recursive symlink "/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Ruby.framework/Versions/Current/Headers/ruby/ruby" -> "/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby"
[Warn - 10:37:20 PM] (26528) Skipping recursive symlink "/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/System/Library/Frameworks/Ruby.framework/Headers/ruby/ruby" -> "/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby"
[Warn - 10:37:20 PM] (26528) Skipping recursive symlink "/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby/ruby" -> "/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby"
[Warn - 10:37:20 PM] (26528) Skipping recursive symlink "/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/System/Library/Frameworks/Ruby.framework/Versions/Current/Headers/ruby/ruby" -> "/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby"
[Warn - 10:37:22 PM] (26528) Skipping recursive symlink "/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Ruby.framework/Headers/ruby/ruby" -> "/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby"
[Warn - 10:37:22 PM] (26528) Skipping recursive symlink "/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby/ruby" -> "/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby"
[Warn - 10:37:22 PM] (26528) Skipping recursive symlink "/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/Current/Headers/ruby/ruby" -> "/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby"
[Warn - 10:37:24 PM] (26528) Skipping recursive symlink "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/Ruby.framework/Headers/ruby/ruby" -> "/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby"
[Warn - 10:37:24 PM] (26528) Skipping recursive symlink "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby/ruby" -> "/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby"
[Warn - 10:37:24 PM] (26528) Skipping recursive symlink "/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/Ruby.framework/Versions/Current/Headers/ruby/ruby" -> "/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby"
Let me know if I should file a separate issue instead. :)
@pradyunsg, are you opening your volume root directory as a folder? When you open a folder within VS Code, Pylance assumes that your project is rooted in that directory and will search for Python source files beneath that point.
No. As I mentioned, this is when I'm joining a live share with that's hosted by someone else. :)
And no, even for the project in that other users' work environment, it's in ~/Developer/flowerpot
-- not /
.
The bug was reported against 2022.4.3, so I think we should reopen.
However, we're going to need much more information to diagnose the problem — preferably a clear set of repro steps. At a minimum, we'll need logs.
Sorry for the late reply, it's been a very busy week. I unfortunately can't share raw trace logs because this is happening on a work computer where there are IP concerns.
Yes, the bug happens in 2022.4.3 and the latest prerelease of 2022.5.x. I walked back versions and the most recent version that doesn't exhibit this bug is 2022.3.0. 2022.3.1 does exhibit this issue, so I'd love to know what changed between these two releases.
Setting the logLevel to Trace
doesn't really point to anything in particular. I see it trying to index files but it seems to be taking a long time on some of our Sconscript files.
I'm seeing this again, this time with non-conda workspace being shared with me.