ycm-core / YouCompleteMe

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

Ycm GotoDeclaration/Definition causes vim to freeze in certain cases #3458

Closed ApolloBian closed 4 years ago

ApolloBian commented 5 years ago

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside the brackets) before filing your issue:

Thank you for adhering to this process! It ensures your issue is resolved quickly and that neither your nor our time is needlessly wasted.

Issue Details

Provide a clear description of the problem, including the following key questions: I have used Ycm for over 2 years and everything works smoothly, however I recently encounter an issue where GotoDeclaration causes vim to freeze (not taking any kind of input including ^C etc) and after some time it says HTTPConnectionPool(host=.....): Read timed out. (read timeout=30). It is very annoying.

All the completion works fine tho, both identifier and semantic.

Include steps to reproduce here. Include description of a minimal test case, including any actual code required to reproduce the issue. A minimal test case:

#!/usr/bin/env python
class TestCase:
def __init__(self):
self.somevalue = 0
def reset_somevalue(self):
self.somevalue = 0
def inc_somevalue(self):
self.somevalue += 1   # invoke on this line breaks vim
def here_it_works_normal(self):
self.reset_somevalues() # invoke on this line will jump to the definition

when invoking GoToDeclaration or GoToDefinition on the somevalue property, vim freezes.

Diagnostic data

Output of vim --version

VIM - Vi IMproved 8.1 (2018 May 18, compiled Jan 28 2019 17:44:00)
macOS version
Included patches: 1-611
Compiled by bian_tianling@sjtu.edu.cn
Huge version without GUI.  Features included (+) or not (-):
+acl               +extra_search      +mouse_netterm     +tag_old_static
+arabic            +farsi             +mouse_sgr         -tag_any_white
+autocmd           +file_in_path      -mouse_sysmouse    -tcl
+autochdir         +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    -gettext           +netbeans_intg     +textprop
+byte_offset       -hangul_input      +num64             +timers
+channel           +iconv             +packages          +title
+cindent           +insert_expand     +path_extra        -toolbar
-clientserver      +job               +perl              +user_commands
+clipboard         +jumplist          +persistent_undo   +vartabs
+cmdline_compl     +keymap            +postscript        +vertsplit
+cmdline_hist      +lambda            +printer           +virtualedit
+cmdline_info      +langmap           +profile           +visual
+comments          +libcall           -python            +visualextra
+conceal           +linebreak         +python3           +viminfo
+cryptv            +lispindent        +quickfix          +vreplace
+cscope            +listcmds          +reltime           +wildignore
+cursorbind        +localmap          +rightleft         +wildmenu
+cursorshape       -lua               +ruby              +windows
+dialog_con        +menu              +scrollbind        +writebackup
+diff              +mksession         +signs             -X11
+digraphs          +modify_fname      +smartindent       -xfontset
-dnd               +mouse             +startuptime       -xim
-ebcdic            -mouseshape        +statusline        -xpm
+emacs_tags        +mouse_dec         -sun_workshop      -xsmp
+eval              -mouse_gpm         +syntax            -xterm_clipboard
+ex_extra          -mouse_jsbterm     +tag_binary        -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/Users/tianling/Applications/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L.  -L/usr/local/lib -o vim        -lncurses  -liconv -framework AppKit   -mmacosx-version-min=10.14 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.28.1/lib/perl5/5.28.1/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc  -L/Users/tianling/.pyenv/versions/3.7.1/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -framework CoreFoundation  -lruby.2.3.0 -lobjc

Output of YcmDebugInfo

Printing YouCompleteMe debug information...
-- Client logfile: /var/folders/5c/9r7xkl9x6zbc9hvykt4hnpsw0000gn/T/ycm_6vml8khq.log
-- Server Python interpreter: /Users/tianling/.pyenv/versions/3.7.1/Python.framework/Versions/3.7/bin/python
-- Server Python version: 3.7.1
-- Server has Clang support compiled in: True
-- Clang version: clang version 8.0.0 (tags/RELEASE_800/final)
-- No extra configuration file found
-- Python completer debug information:
--   Python interpreter: /Users/tianling/.pyenv/versions/3.7.1/envs/everything/bin/python
--   Python path: ['/Users/tianling/.pyenv/versions/3.7.1/Python.framework/Versions/3.7/lib/python37.zip', '/Users/tianling/.pyenv/versions/3.7.1/Python.framework/Versions/3.7/lib/python3.7', '/Users/tianling/.pyenv/versi
ons/3.7.1/lib/python3.7/lib-dynload', '/Users/tianling/.pyenv/versions/3.7.1/envs/everything/lib/python3.7/site-packages']
--   Python version: 3.7.1
--   Jedi version: 0.13.3
--   Parso version: 0.3.4
-- Server running at: http://127.0.0.1:50678
-- Server process ID: 7893
-- Server logfiles:
--   /var/folders/5c/9r7xkl9x6zbc9hvykt4hnpsw0000gn/T/ycmd_50678_stdout_y548jr90.log
--   /var/folders/5c/9r7xkl9x6zbc9hvykt4hnpsw0000gn/T/ycmd_50678_stderr_z31xy6rt.log

Contents of YCM, ycmd and completion engine logfiles

Add let g:ycm_log_level = 'debug' to vimrc, restart Vim, reproduce the issue, and include link here to a [gist][] containing the entire logfiles for ycm, ycmd and any completer logfiles listed by :YcmToggleLogs.

ycm_015czata.log ycmd_51139_stderr_iqtdumfz.log

OS version, distribution, etc.

I have tested on Linux and MacOS. Same behavior

ApolloBian commented 5 years ago

YouCompleteMe: fa92f40d0209469a037196fdc3d949ae29d0c30a

ApolloBian commented 5 years ago

Also, using gd or gD does jump to the __init__ function, so I suppose it is not the problem with my test case.

bstaletic commented 4 years ago

I've noticed this recently too. I'm looking into it.

bstaletic commented 4 years ago

Found the culprit. The same reason why I opened https://github.com/ycm-core/ycmd/issues/1341

bstaletic commented 4 years ago

Until we figure out how to fix this, use GoToType as that does now what GoTo used to do.

bstaletic commented 4 years ago

Fixed.

ApolloBian commented 4 years ago

@bstaletic Cool! Appreciate the good work!