ycm-core / YouCompleteMe

A code-completion engine for Vim
http://ycm-core.github.io/YouCompleteMe/
GNU General Public License v3.0
25.42k stars 2.81k forks source link

YCM and unite.vim preview window #1485

Closed mrbiggfoot closed 8 years ago

mrbiggfoot commented 9 years ago

I use unite.vim with auto-preview feature. What it does is opening many buffers in a short period of time (i.e. when I browse the unite window, it shows a preview for each item in the preview window). I think YCM tries to parse each one of these short-lived buffers opened solely for previewing purposes, which sometimes just shows errors and requires YcmRestartServer, and sometimes just crashes my vim.

Can this be fixed? I wonder if it's possible to determine if the buffer is shown only in the preview window and if that's the case don't run YCM on it.

vheon commented 9 years ago

Is it the vim preview window or a buffer used as preview created by Unite?

mrbiggfoot commented 9 years ago

It is the vim preview window. At least, a quick look into the unite sources reveals that it's closed with "pclose", so that must be the vim preview window.

Shougo commented 9 years ago

I think YCM should ignore preview window.

mrbiggfoot commented 9 years ago

Ok, I reproed it again. Here are the errors from YCM (the beginning):

The ycmd server SHUT DOWN (restart with :YcmRestartServer). Stderr (last 30 lines):

2015-04-30 15:14:40,663 - INFO - Received health request 2015-04-30 15:14:40,670 - INFO - Received event notification 2015-04-30 15:14:40,686 - INFO - Received event notification 2015-04-30 15:14:40,687 - INFO - Received event notification 2015-04-30 15:14:40,687 - INFO - Adding buffer identifiers for file: /home/xxx/projects/main/cerebro/test/delete_shell_vdisk_test.cc 2015-04-30 15:14:40,694 - INFO - Received event notification 2015-04-30 15:14:40,701 - INFO - Received event notification 2015-04-30 15:14:40,701 - INFO - Adding buffer identifiers for file: /home/xxx/projects/main/cerebro/test/delete_shell_vdisk_test.cc Traceback (most recent call last): File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 861, in _handle return route.call(_args) File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1734, in wrapper rv = callback(_a, _ka) File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 100, in wrapper return callback( args, _kwargs ) File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 62, in wrapper body = callback( _args, _kwargs ) File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification event_handler )( request_data ) File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 268, in OnFileReadyToParse with self._files_being_compiled.GetExclusive( filename ): File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/ephemeral_values_set.py", line 56, in enter raise RuntimeError( ALREADY_PARSING_MESSAGE ) RuntimeError: File already being parsed. 2015-04-30 15:15:13,901 - INFO - Received event notification 2015-04-30 15:15:13,933 - INFO - Received event notification 2015-04-30 15:15:13,977 - INFO - Received event notification 2015-04-30 15:15:13,982 - INFO - Received event notification 2015-04-30 15:15:13,984 - INFO - Adding buffer identifiers for file: /home/xxx/projects/main/cerebro/test/cerebro_test_site.cc 2015-04-30 15:15:14,006 - INFO - Received event notification 2015-04-30 15:15:14,008 - INFO - Received event notification 2015-04-30 15:15:14,015 - INFO - Received event notification 2015-04-30 15:15:14,017 - INFO - Adding buffer identifiers for file: /home/xxx/projects/main/cerebro/test/cerebro_test_site.cc Traceback (most recent call last): File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 861, in _handle return route.call(_args) File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1734, in wrapper rv = callback(_a, _ka) File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 100, in wrapper return callback( args, _kwargs ) File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 62, in wrapper body = callback( _args, _kwargs ) File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification event_handler )( request_data ) File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 268, in OnFileReadyToParse with self._files_being_compiled.GetExclusive( filename ): File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/ephemeral_values_set.py", line 56, in enter raise RuntimeError( ALREADY_PARSING_MESSAGE ) RuntimeError: File already being parsed. 2015-04-30 15:15:18,772 - INFO - Received event notification 2015-04-30 15:15:18,783 - INFO - Received event notification 2015-04-30 15:15:18,786 - INFO - Received event notification 2015-04-30 15:15:18,787 - INFO - Adding buffer identifiers for file: /home/xxx/projects/main/cerebro/test/delete_shell_vdisk_test.cc 2015-04-30 15:15:18,791 - INFO - Received event notification 2015-04-30 15:15:18,792 - INFO - Received event notification 2015-04-30 15:15:18,796 - INFO - Received event notification 2015-04-30 15:15:18,796 - INFO - Adding buffer identifiers for file: /home/xxx/projects/main/cerebro/test/delete_shell_vdisk_test.cc Traceback (most recent call last): File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 861, in _handle return route.call(_args) File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1734, in wrapper rv = callback(_a, _ka) File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 100, in wrapper return callback( args, _kwargs ) File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 62, in wrapper body = callback( _args, *_kwargs ) File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification event_handler )( request_data ) File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 268, in OnFileReadyToParse with self._files_being_compiled.GetExclusive( filename ): File "/home/xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/ephemeral_values_set.py", line 56, in enter raise RuntimeError( ALREADY_PARSING_MESSAGE ) RuntimeError: File already being parsed.

vheon commented 9 years ago

@Shougo I thought that we already did.

mrbiggfoot commented 9 years ago

One more observation.

Open a cpp file in vim. In the other window run "top" and monitor CPU usage of the python2 process that runs ycmd. Wait until CPU usage by ycmd goes to zero (that would mean the parsing of the opened file is complete, correct?). Now, search for a tag with unite and enable auto-preview. See that CPU usage of the python2 process goes above the roof. Ideally, ycmd should be idle while I'm just browsing the tags with preview.

puremourning commented 8 years ago

Does this happen when you use the preview window without unite.vim, e.g. using tags files? I believe @vheon is right that we don't try and complete in the preview window (at least attempt not to!). I'd like to rule out unite.vim as a suspect before any detailed investigation (as I don't personally use unite.vim).

mrbiggfoot commented 8 years ago

@puremourning, yes, it does happen when I find a tag using 'ptag' and then run 'ptnext' several times, making the previewed buffer switch.

micbou commented 8 years ago

Should be fixed by PR #2312.