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
neovim lsp client stuck on CPU 100% / a very high CPU usage with big files #14037
Comments
Can you reproduce this without completion.nvim (with omnifunc)? Otherwise this belongs on the completion.nvim tracker, and I would encourage you to try out https://github.com/hrsh7th/nvim-compe |
@mjlbach after disable (and I also disabled other lsp related plugins) The problem still persists the log (too long, can not post here): |
After I disabled and nvim lsp continue can stuck on CPU 100% so I check the log, and edit neovim runtome file: Things have changed. the golang source code I used to re-produce the issue: (clone the whole repo this file has about 4KB size, and about 1124 lines. (if we use a 3000 lines source file, the result will be more obvious) open the modified even I disabled and last, my hardware: ❯ neofetch
/:-------------:\ ttys3@fedora
:-------------------:: ------------
:-----------/shhOHbmp---:\ OS: Fedora 33 (Workstation Edition) x86_64
/-----------omMMMNNNMMD ---: Kernel: 5.10.19-200.fc33.x86_64
:-----------sMMMMNMNMP. ---: Uptime: 1 hour, 30 mins
:-----------:MMMdP------- ---\ Packages: 2962 (rpm), 23 (flatpak)
,------------:MMMd-------- ---: Shell: zsh 5.8
:------------:MMMd------- .---: Resolution: 3840x2160
:---- oNMMMMMMMMMNho .----: DE: GNOME 3.38.3
:-- .+shhhMMMmhhy++ .------/ WM: Mutter
:- -------:MMMd--------------: WM Theme: Adwaita
:- --------/MMMd-------------; Theme: Adwaita [GTK2/3]
:- ------/hMMMy------------: Icons: Adwaita [GTK2/3]
:-- :dMNdhhdNMMNo------------; Terminal: tmux
:---:sdNMMMMNds:------------: CPU: Intel i7-8700K (12) @ 4.700GHz
:------:://:-------------:: GPU: Intel CometLake-S GT2 [UHD Graphics 630]
:---------------------:// GPU: NVIDIA GeForce GTX 1060 3GB
Memory: 10467MiB / 31528MiB |
While neovim is CPU 100% and stuck, if I kill neovim with Error detected while processing VimLeavePre Autocommands for "*":
Error executing vim.schedule lua callback: /usr/local/share/nvim/runtime/lua/vim/treesitter/query.lua:135:
bad argument #1 to 'get_node_text' (string expected, got nil)
Error executing vim.schedule lua callback: /usr/local/share/nvim/runtime/lua/vim/treesitter/query.lua:135:
bad argument #1 to 'get_node_text' (string expected, got nil)
Error executing vim.schedule lua callback: /usr/local/share/nvim/runtime/lua/vim/treesitter/query.lua:135:
bad argument #1 to 'get_node_text' (string expected, got nil)
Error executing vim.schedule lua callback: /usr/local/share/nvim/runtime/lua/vim/treesitter/query.lua:135:
bad argument #1 to 'get_node_text' (string expected, got nil)
-- More --
|
Can you reproduce this with a minimal config? That's a tree-sitter error. You can use this with modifications to work for gopls. |
@glepnir I think my description to re-produce the issue is not clear. I tried again use the init.vim I provided above, the issue is a 100% re-produce-able I re-edited the description above and make it clear:
and also, thank you @mjlbach, I'll try the |
cannot reproduce… I used same file |
Just typing you should try this modified file: clone the whole repo https://github.com/blevesearch/bleve, and replace the go file analysis/lang/fr/light_stemmer_fr_test.go with this one: |
@mjlbach confirmed: using the |
Seems like you should bisect your config then to find the offending plugin :) |
@mjlbach got |
So it seems like a completion.nvim issue then? Did you try comp-e? |
@mjlbach After I add this to my Makefile, finally I found the reason: # pure all before debug problems
purge:
mv ~/.config/nvim/init.vim{,.disabled}
mv ~/.config/nvim/init.lua{,.disabled}
rm -rf ~/.local/share/nvim && mkdir ~/.local/share/nvim && rm -rf ~/.cache/nvim && mkdir ~/.cache/nvim && rm -rf rm -rf /tmp/site
curl -fLo $$HOME/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
caused by disable the plugin, the CPU will not stuck on 100% now. (CPU usage will go down to 0 if we stop press xxxxxxxxxxx crazyly, but it will not if we have treesitter and the I do disabled all plugins (including nvim-ts-rainbow) by using
and the result in |
Alright, I'm going to close the issue here then (since it's an issue with plugins), but I recommend you file issues with |
@mjlbach OK, to test if |
@ttys3 Glad you found out about the rainbow problem. Consider only enabling autocomplete on keypress (default is for nvim-compe).
|
This is off-topic, but we do incremental sync now by default (so the amount of data sent is very small), and mfussengers has a PR to do debouncing. |
nvim --version
:gopls version v0.6.6
Ubuntu 20.10 x86_64
nvim -c ":checkhealth nvim lspconfig"
lsp.log
the log included the whole source code (I can not provide here because it is not open sourced code and I do not own the copyright), I removed the file content in the log
Steps to reproduce
init.vim:
the golang source code I used to re-produce the issue:
(clone the whole repo
https://github.com/blevesearch/bleve
, and replace the go fileanalysis/lang/fr/light_stemmer_fr_test.go
with this one: https://gist.github.com/ttys3/a0fd236ebff873204927f090f84a33fe/raw/77067a8b477071e929cfa6cc3f911cc2665930ff/light_stemmer_fr_test.go )this file has about 4KB size, and about 1124 lines.
open the modified
analysis/lang/fr/light_stemmer_fr_test.go
, goto line 1123, type//
and then type single charx
fast as you can. (do not type too slow, and then neovim lsp client will continue to sendthe whole file
to lsp server)neovim cpu will 100%
disable lsp and lsp auto completion, the problem did not occurred
Actual behaviour
neovim stuck on CPU 100% and for minutes it can not handle anything
I symlinked
neovim
tovi
so that I could execute it fast(only two chars to enter), don't confused by the executable namevi
Expected behaviour
auto completion works without no explicit stop time
FAQ
Q: why do you write comments like this ? (
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
)A: this is just a file I want to show the issue.
because I could not provide the real file (about 2k lines) here.
yes, no one will write comments like this. or coding fast like this.
I encountered the issue in the real life with a source file about 2k lines code, and typing with slow and normal speed, the CPU goes 100%. ( and this is why I created the issue. I can not use neovim to do the job with a big file. my cursor just can not move with CPU 100% )
The text was updated successfully, but these errors were encountered: