iamcco / coc-vimlsp

viml language server
216 stars 7 forks source link

High CPU usage #5

Closed oblitum closed 5 years ago

oblitum commented 5 years ago

First time this is happening, I think it's due to last changes. When I open my .vimrc now (around 2k lines) the node instance for vimlsp fully consumes one core and doesn't stop until I close neovim.

iamcco commented 5 years ago

I have add vimlsp.indexes.gap option default from 0 to 100 to slow down CPU usage, this will also slow down index speed.

You can also change vimlsp.indexes.count to smaller, default is 3, this effect the count of files index at the same time.

Finally, if you don't want to get completeItems from vim's runtimepath, you can set vimlsp.indexes.runtimepath to false, this will let the behaviour same as before.

oblitum commented 5 years ago

Thanks, but even with new default I'm getting high CPU usage (I think there's some bug, because it takes 100% of one core). I'll see whether setting vimlsp.indexes.runtimepath to false fixes it.

oblitum commented 5 years ago

I'll see whether setting vimlsp.indexes.runtimepath to false fixes it.

Sadly even this didn't fix the issue. I think there should be some loop bug.

oblitum commented 5 years ago

I think the issue should be on language server actually, not the plugin, since I've not seen any relevant commit lately except for language server upgrades.

oblitum commented 5 years ago

It takes around one minute after I open my .vimrc for it to start looping, it doesn't happen right after opening neovim. Then it never ceases to consume CPU.

iamcco commented 5 years ago

Can't reproduce. Change vimlsp.indexes.count to 1 and vimlsp.indexes.gap to 1000 to see what happend

oblitum commented 5 years ago

@iamcco this seems like it made the problem go away.

oblitum commented 5 years ago

if you want to try my .vimrc to check for the issue, it's this one. You have to run :PlugInstall to install the plugins.

oblitum commented 5 years ago

@iamcco this seems like it made the problem go away.

I was wrong, it just happened while I was editing code. Just more difficult for it to happen now.

iamcco commented 5 years ago

I have change default count to 1. I can't do more because I can't reproduce.

Test with default options with my MacBook Pro (13-inch):

2019-08-07 16-00-48 2019-08-07 16_08_01

oblitum commented 5 years ago

I dunno how exactly to reproduce, it happens after a while while editing my .vimrc.

I'm on ArchLinux using NeoVim master.

12:38:50_07-08-2019

oblitum commented 5 years ago

The picture shows it's the scan.js that's doing it.

iamcco commented 5 years ago

I catch the problem, it seems vimlparser get dead loop while parse https://github.com/oblitum/formatvim/blob/master/autoload/format.vim

I have create issue https://github.com/vim-jp/vim-vimlparser/issues/144

oblitum commented 5 years ago

Just to avoid any confusion, I use it from https://github.com/oblitum/formatvim, not vim-scripts.

iamcco commented 5 years ago

OK, I have update the url

oblitum commented 5 years ago

For what's worth, I removed that plugin and frawor from my plugin dir but it still gets in a dead loop, maybe there's another one that causes it, possibly one of these:

1016    emmet-vim/autoload/emmet/lang/html.vim
1018    vimproc/autoload/vimproc/parser.vim
1057    vimtex/autoload/vimtex/delim.vim
1065    vimtex/autoload/vimtex/complete.vim
1079    frawor/autoload/frawor/mappings.vim
1087    frawor/plugin/frawor.vim
1104    vim-localvimrc/plugin/localvimrc.vim
1126    emmet-vim/unittest.vim
1132    frawor/autoload/frawor/fwc/compiler.vim
1163    gist-vim/autoload/gist.vim
1218    vim-gnupg/autoload/gnupg.vim
1352    vim-dispatch/autoload/dispatch.vim
1353    vim-quickrun/autoload/quickrun.vim
1360    vim-mma/syntax/mma.vim
1446    vim-mma/after/syntax/mma.vim
1528    frawor/autoload/frawor/fwc/intfuncs.vim
1586    gruvbox/colors/gruvbox.vim
1797    vimproc/autoload/vimproc.vim
1955    pgsql.vim/syntax/pgsql.vim
2065    emmet-vim/autoload/emmet.vim
2101    vim-cpp-enhanced-highlight/after/syntax/cpp.vim
2279    vim-plugin-AnsiEsc/autoload/AnsiEsc.vim
2555    formatvim/test/filetype.vim
2685    formatvim/samples/rtp/filetype.vim
4369    formatvim/autoload/format.vim
5603    vim-fugitive/autoload/fugitive.vim

Thanks for reporting the issue on vimlparser.

oblitum commented 5 years ago

Removing https://github.com/echuraev/translate-shell.vim/blob/master/autoload/common/history.vim from my plugins I stopped having this issue. I think it's vim-vimlparser to blame, so feel free to close it here if you think that's OK.

iamcco commented 5 years ago

I have fix the problem.