-
Notifications
You must be signed in to change notification settings - Fork 32
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
Extension causes high cpu load #146
Comments
Hey joshrbarcodefactory! Thank you for reporting the issue and for attaching the cpuprofile. I see that you are using version 10.2.0 of the extension. In 10.3.0 I added a new feature that limits the number of parallel blame processes that gets spawned. It would be very helpful to know if the issue persist with the new version. |
I have been able to recreate what I think is the issue. |
I couldn't reproduce it when I tried. I will update to 10.3.0 and see if it happens in my everyday use. |
I am no expert on these things but it looks like the issue is that the microtask queue never runs out of things to do. While the first microtask is parsing the return value from the git blame process stdout stream and sending it to the cache the next git blame chunk is sent and it queues another microtask. As long as there are microtasks in the queue they will keep going and never letting the task queue execute. This should be quite hard to reproduce as it requires the git blame process to be quite fast (queuing new microtasks when pushing to stdout) while the extension host is slow (parsing and storing git blame information). I've been testing a few things with different task and microtask interruptions. The latest one is to use setImmediate when processing the git blame process output. That should make the worst case scenario a bit less bad but I do not know if it removes the issue entirely. I will need do to a bit more digging or if someone with a lot more experience with these things happens upon this can shed some light on it. |
I just uploaded 10.4.0 with a potential fix. I'll close this for now, please comment again if the issue persists! |
Version How is it working under the hood? |
It has a per file cache that gets invalidated whenever the file is closed in the editor and when the file or If the extension is causing high CPU load after the "max two at the time"-change the only reason I can think of is the git blame process itself and I do not have any impact on that. |
waderyan.gitblame-unresponsive.cpuprofile.txt
Performance
gitblame
10.2.0
Linux x64 5.19.0-45-generic
1.77.3
file:///tmp/waderyan.gitblame-unresponsive.cpuprofile.txt
Find more details here: https://github.com/microsoft/vscode/wiki/Explain-extension-causes-high-cpu-load
I have been having issues with this extension periodically over the last few months. It gets stuck and displays "Waiting for git blame response" and prevents any other features like format on save feature to work.
It is really a pain when you are using the debugger and this happens because you have to disable the extension, click "Reload", then kill any of the spawned processes from the debugger. I have seen a few reports of this but no one followed the "attach the file" instructions. This is one of the most useful extensions I use, so its a shame to have to turn it off immediately after using it.
Let me know if there is any other info you need from me.
The text was updated successfully, but these errors were encountered: