New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
100% CPU usage (macos) #1078
Comments
Pylance's analysis does not run in the VS Code renderer. Can you check something like top/htop to see what the CLI args are for that process? That dump unfortunately doesn't list them (and I don't see pylance mentioned). This could be similar to #1035 and may be the interpreter detection code in the core Python extension. |
Thanks. Unfortunate that we show as "renderer" 🙁. Do you have trace logs or an example project that may help us reproduce it? If you set |
I have exactly the same problem. Setting Also, even when you quit VSCode entirely the pylance process keeps running, consuming 100% CPU. Here's the output from the Python Language Server logs:
I can reproduce it for now, but unfortunately the code is all private. Is there something simple I can do to debug it? I tried sampling the process but it's just V8 stuff. Wild guess - this is in a workspace with |
It's a hidden setting; the graying out is expected.
Do these folders by chance contain recursive symlinks? There's a known bug (fixed in the next release) that does lead to some infinite behavior, but it may not actually fix this. Do you have many multi-root workspaces or many pyright execution environments? It's a bit scary that we aren't quitting when the parent process ends... but that's something that VS Code or the init system is supposed to be handling. Unless I'm mistaken, I'd think that all UNIX-alikes will kill off processes which haven't been explicitly unparented if the parent process has exited. Back in MPLS, we watched for parent process exit to ensure that the process exits, but this doesn't solve the high CPU usage when it's actually supposed to be running. One thing that may be interesting are the (even more) verbose logs, which you can enable with a pyrightconfig.json file: {
"verboseOutput": true
} I understand your code is private, so I would not attach these at all, but it'd be interesting to see what (after a while) it's doing. |
For sure most of our projects do use symlinks, usually something like Yes, most of the time I do have 4-5 and up to 10 python projects/folders open inside an Untitled workspace. All of them are using the same python version. I wonder if I should try to switch python version to use brew installed one instead of pyenv, just to rule out a bug specific to pyenv (I am not sure if the shimming is confusing pylance). One of the very weird things around this bug is that the parent process appears to be I am going to try to other things during the day and update my answer, with bit of luck we will narrow it down. |
I tried putting that file in a few places but it didn't seem to have any effect. I get the exact same logs from the language server. :-/ But I managed to figure it out anyway! I thought I didn't have any symlinks in my code, but it turns out a recursive one was added by a Rust crate (cxx). Debugging this was a bit of a pain - here's what I went through: I profiled the process with Instruments and it shows about 5k I tried the System Call Trace instrument and while it does capture the Finally I tried using
At last, paths! But they are truncated at 255 characters. This is a dtrace option but unfortunately isn't exposed by dtruss, so what you have to do is:
That finally gives full paths and shows it is accessing recursive symlinks. So when's the next release? :-) |
Tomorrow. Hopefully this fixes all of the problems you both have been having. I really appreciate the debugging efforts you've done to trace this out. It's a bit difficult to tease this info out over a GitHub issue. 🙂 #1070 is the issue, for reference, but it's possible that there's another code path we've still missed for this (so I'll leave this open and not close it as a dupe for now). One way to confirm is to downgrade to 2021.3.0 or 2021.3.1; the former didn't have symlink support and the later almost had it, so you should be able to see a difference. |
We've just release 2021.3.3; if you could retest and see if the issue is fixed, that'd be appreciated. |
Fixed for me, thanks! |
I got |
At this point, I'm convinced this is fixed. We can reopen this if it's persisting. 2021.3.4 contains another symlink fix (handling broken links), but you would have seen crashes if that were in play. |
Hey there! I see similar behaviour now
I tried to turn off pylance, vscode needed a restart after which that pid was gone. Then I turned on pylance again and in couple of seconds got that process back with 100% core utilisation I am using m1 pro macbook, monterey 12.2, VSCode 1.64.2 (Universal) |
Stay tuned for next release this Wednesday |
This is still happening to me on the latest VSCode 1.66.2 with what looks like pylance 2022.4.1. |
This is also happening to me on pylance
It seems to be triggered when I have more than 1 VSCode window open (cmd-shift-N), I did not notice with previous versions of pylance/vscode... I also see the pylance process continue to run after quitting vscode. |
Finding the same issue occurring on pylance |
Confirm it's happening on mac os m1. Process is showing the following:
|
Hoping someone can triage this as high priority. VSCode is unusable for me right now with this bug. |
See this issue here: #3554. The prerelease version should have the fix. |
Issue Type: Bug
Since two days ago pylance seems to start a different thead that takes 100% CPU and never finishes.
I updated to daily insiders and it still happens. The thread remains open and taking all the CPU even after I quit vscode (and macos launcher no longer reports the as running). Still, the activity monitor shows Code Helper (Rendered) still running and taking all the cpu it can. I did a spindump of it https://gist.github.com/ssbarnea/28da5f10b5d50a7166ef5c425a7d7135
Even after killing it and starting again, it seems to do hte same. As this takes only on core, it may be harder to observe but it happening and the fan never stops.
Extension version: 2021.3.3-pre.1
VS Code version: Code 1.54.3 (2b9aebd5354a3629c3aba0a5f5df49f43d6689f8, 2021-03-15T11:57:12.728Z)
OS version: Darwin x64 20.3.0
System Info
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled
A/B Experiments
I am not sure if that is relevant by the default python interpreter path is configured to be /Users/ssbarnea/.pyenv/shims/python3 -- which happens to be python 3.9.2 installed using pyenv, so it matches the one I use in terminal.
The text was updated successfully, but these errors were encountered: