ycm-core / YouCompleteMe

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

YCMD crashing on large projects #2576

Closed Bothari closed 7 years ago

Bothari commented 7 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:

Load a .cpp file from a reasonably large project (the ycmd source in my test case). YCMD crashes almost immediately.

Include steps to reproduce here.

  1. Start a fresh instance of gvim.
  2. Load youcompleteme\third_party\ycmd\cpp\ycm\Candidate.cpp
  3. Check output of :YcmDebugInfo and notice server has crashed and provides no completion information.

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

I'm unable to generate a suitably large test project, but simply using the latest install of ycmd from GitHub repros the crash. Using a smaller test project (a few dozen cpp and h files) does not reproduce the problem, ycmd runs successfully without crashing.

Diagnostic data

Output of vim --version

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled May 17 2016 22:29:43)
MS-Windows 64-bit GUI version with OLE support
Included patches: 1-1832
Compiled by appveyor@APPVEYOR-VM
Huge version with GUI.  Features included (+) or not (-):
+acl                +comments           +ex_extra           +keymap             +multi_lang         +reltime            -termguicolors      +wildignore
+arabic             +conceal            +extra_search       +langmap            +mzscheme/dyn       +rightleft          -tgetent            +wildmenu
+autocmd            +cryptv             +farsi              +libcall            +netbeans_intg      +ruby/dyn           -termresponse       +windows
+balloon_eval       +cscope             +file_in_path       +linebreak          +ole                +scrollbind         +textobjects        +writebackup
+browse             +cursorbind         +find_in_path       +lispindent         +packages           +signs              +timers             -xfontset
++builtin_terms     +cursorshape        +float              +listcmds           +path_extra         +smartindent        +title              -xim
+byte_offset        +dialog_con_gui     +folding            +localmap           +perl/dyn           +startuptime        +toolbar            -xterm_save
+channel            +diff               -footer             +lua/dyn            +persistent_undo    +statusline         +user_commands      +xpm_w32
+cindent            +digraphs           +gettext/dyn        +menu               -postscript         -sun_workshop       +vertsplit          
+clientserver       +directx            -hangul_input       +mksession          +printer            +syntax             +virtualedit        
+clipboard          -dnd                +iconv/dyn          +modify_fname       +profile            +tag_binary         +visual             
+cmdline_compl      -ebcdic             +insert_expand      +mouse              +python/dyn         +tag_old_static     +visualextra        
+cmdline_hist       +emacs_tags         +job                +mouseshape         +python3/dyn        -tag_any_white      +viminfo            
+cmdline_info       +eval               +jumplist           +multi_byte_ime/dyn +quickfix           +tcl/dyn            +vreplace           
   system vimrc file: "$VIM\vimrc"
     user vimrc file: "$HOME\_vimrc"
 2nd user vimrc file: "$HOME\vimfiles\vimrc"
 3rd user vimrc file: "$VIM\_vimrc"
      user exrc file: "$HOME\_exrc"
  2nd user exrc file: "$VIM\_exrc"
  system gvimrc file: "$VIM\gvimrc"
    user gvimrc file: "$HOME\_gvimrc"
2nd user gvimrc file: "$HOME\vimfiles\gvimrc"
3rd user gvimrc file: "$VIM\_gvimrc"
    system menu file: "$VIMRUNTIME\menu.vim"
Compilation: cl -c /W3 /nologo  -I. -Iproto -DHAVE_PATHDEF -DWIN32  -DFEAT_CSCOPE -DFEAT_NETBEANS_INTG -DFEAT_JOB_CHANNEL   -DFEAT_XPM_W32   -DWINVER=0x500 -D_WIN32_WINNT=0x500  /Fo.\ObjGXOULYHTRZAMD64/ /Ox /GL -DNDEBUG  /Zl /MT -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_MBYTE -DFEAT_GUI_W32 -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl86.dll\" -DDYNAMIC_TCL_VER=\"8.6\" -DFEAT_LUA -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua53.dll\" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python34.dll\" -DFEAT_MZSCHEME -I "C:\Program Files\Racket\include" -DMZ_PRECISE_GC -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libracket3m_9zltds.dll\" -DDYNAMIC_MZGC_DLL=\"libracket3m_9zltds.dll\" -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl522.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=22 -DDYNAMIC_RUBY_DLL=\"x64-msvcrt-ruby220.dll\" -DFEAT_HUGE /Fd.\ObjGXOULYHTRZAMD64/ /Zi
Linking: link /RELEASE /nologo /subsystem:windows /LTCG:STATUS oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib  comdlg32.lib ole32.lib uuid.lib /machine:AMD64 gdi32.lib version.lib   winspool.lib comctl32.lib advapi32.lib shell32.lib  /machine:AMD64 /nodefaultlib libcmt.lib oleaut32.lib user32.lib  /nodefaultlib:lua53.lib  /STACK:8388608  /nodefaultlib:python27.lib /nodefaultlib:python34.lib   "C:\Tcl\lib\tclstub86.lib" WSock32.lib xpm\x64\lib\libXpm.lib /PDB:gvim.pdb -debug

Output of YcmDebugInfo

Printing YouCompleteMe debug information...
-- Client logfile: c:\temp\ycm_zfetpv.log
-- Server errored, no debug info from server
-- Server running at: http://127.0.0.1:65006
-- Server process ID: 47072
-- Server logfiles:
--   c:\temp\ycmd_65006_stdout__r2tvn.log
--   c:\temp\ycmd_65006_stderr_n021oy.log

Restarting ycmd server...

Printing YouCompleteMe debug information...
-- Client logfile: c:\temp\ycm_zfetpv.log
-- Server Python interpreter: C:\Users\MDYCKH~1\AppData\Local\Programs\Python\Python35\python.exe
-- Server Python version: 3.5.1
-- Server has Clang support compiled in: True
-- Clang version: clang version 4.0.0 (tags/RELEASE_400/final)
-- Extra configuration file found and loaded
-- Extra configuration path: c:\Program Files\Vim\vimfiles\plugged\youcompleteme\third_party\ycmd\cpp\ycm\.ycm_extra_conf.py
-- C-family completer debug information:
--   Compilation database path: None
--   Flags: ['-Wall', '-Wextra', '-Werror', '-Wno-long-long', '-Wno-variadic-macros', '-fexceptions', '-DNDEBUG', '-DUSE_CLANG_COMPLETER', '-std=c++11', '-x', 'c++', '-isystem', 'c:\\Program Files\\Vim\\vimfiles\\plugged\\youcompleteme\\third_party\\ycmd\\cpp\\ycm\\../BoostParts', '-isystem', '/System/Library/Frameworks/Python.framework/Headers', '-isystem', 'c:\\Program Files\\Vim\\vimfiles\\plugged\\youcompleteme\\third_party\\ycmd\\cpp\\ycm\\../llvm/include', '-isystem', 'c:\\Program Files\\Vim\\vimfiles\\plugged\\youcompleteme\\third_party\\ycmd\\cpp\\ycm\\../llvm/tools/clang/include', '-I', 'c:\\Program Files\\Vim\\vimfiles\\plugged\\youcompleteme\\third_party\\ycmd\\cpp\\ycm\\.', '-I', 'c:\\Program Files\\Vim\\vimfiles\\plugged\\youcompleteme\\third_party\\ycmd\\cpp\\ycm\\./ClangCompleter', '-isystem', 'c:\\Program Files\\Vim\\vimfiles\\plugged\\youcompleteme\\third_party\\ycmd\\cpp\\ycm\\./tests/gmock/gtest', '-isystem', 'c:\\Program Files\\Vim\\vimfiles\\plugged\\youcompleteme\\third_party\\ycmd\\cpp\\ycm\\./tests/gmock/gtest/include', '-isystem', 'c:\\Program Files\\Vim\\vimfiles\\plugged\\youcompleteme\\third_party\\ycmd\\cpp\\ycm\\./tests/gmock', '-isystem', 'c:\\Program Files\\Vim\\vimfiles\\plugged\\youcompleteme\\third_party\\ycmd\\cpp\\ycm\\./tests/gmock/include', '-resource-dir=C:\\PROGRA~1\\Vim\\vimfiles\\plugged\\YOUCOM~1\\THIRD_~1\\ycmd\\ycmd\\..\\clang_includes', '-fno-delayed-template-parsing', '-fspell-checking']
-- Server running at: http://127.0.0.1:65043
-- Server process ID: 29532
-- Server logfiles:
--   c:\temp\ycmd_65043_stdout_ajziq0.log
--   c:\temp\ycmd_65043_stderr_lonf2o.log

Contents of YCM, ycmd and completion engine logfiles

ycm_zfetpv.log.txt ycmd_65006_stderr_n021oy.log.txt ycmd_65006_stdout__r2tvn.log.txt

OS version, distribution, etc.

Windows 7 Professional SP1. I built ycmd myself from latest source using these steps:

cmake -G "Visual Studio 12 Win64" -DPATH_TO_LLVM_ROOT="c:\Program Files\LLVM" -DUSE_PYTHON2=0 -DPYTHON_INCLUDE_DIR="C:\Users\mdyckhoff\appdata\local\Programs\Python\Python35\include" -DPYTHON_LIBRARY="C:\Users\mdyckhoff\appdata\local\Programs\Python\Python35\libs\python35.lib" . "c:\Program Files\Vim\vimfiles\plugged\youcompleteme\third_party\ycmd\cpp"
cmake --build . --target ycm_core --config Release
Bothari commented 7 years ago

I realise that this isn't the most insightful bug report, ("it crashes!!"), but perhaps there's something in the logs that I am missing, or perhaps I have configured things incorrectly. YCMD has been working fine for me for months, but I updated, rebuilt and suddenly it started crashing.

Adding my vimrc YCM specific configuration info too, in case it's helpful.

" you complete me
:let g:ycm_server_python_interpreter = "C:/Users/mdyckhoff/AppData/Local/Programs/Python/Python35/python.exe"
:let g:ycm_confirm_extra_conf = 0
:let g:ycm_autoclose_preview_window_after_insertion = 1
:let g:ycm_key_list_select_completion = ['<TAB>', '<Down>']
:let g:ycm_server_keep_logfiles = 1
:let g:ycm_server_log_level = 'debug'
puremourning commented 7 years ago

Thanks for the report!

I can see from the debug info that you're using clang 4.0. I wonder if this might be related to the clang 4 upgrade we just did.

However, I notice that the clang 4.0 change (https://github.com/Valloric/ycmd/commit/ca5d9f842f182c91d7e44fdc69b996521b9c9d16) has not been updated into YCM, did you either:

As such, could you try checking out the commit prior to the above PR being merged, say https://github.com/Valloric/ycmd/commit/de3e92aadd421e3a23412101a84d1abbe56afb4d and seeing if you get the same result (after a rebuild)?

Bothari commented 7 years ago

Thanks for the speedy reply! I hadn't considered the Clang version being an issue. Concerning your two questions:

Thing is, we don't actually use clang 4.0, we are doing PS4 development and using a branched version of clang 3.8. I was only building against clang 4.0 because that's what I downloaded.

To try and remedy the situation, I instead downloaded llvm 3.9.1 installer, extracted the libraries and put them somewhere, pointed my cmake command at that instead, and it now works! My updated command line is now this.

cmake -G "Visual Studio 12 Win64" -DPATH_TO_LLVM_ROOT="c:\Users\mdyckhoff\Projects\llvm-3.9.1" -DUSE_PYTHON2=0 -DPYTHON_INCLUDE_DIR="C:\Users\mdyckhoff\appdata\local\Programs\Python\Python35\include" -DPYTHON_LIBRARY="C:\Users\mdyckhoff\appdata\local\Programs\Python\Python35\libs\python35.lib" . "c:\Program Files\Vim\vimfiles\plugged\youcompleteme\third_party\ycmd\cpp"

Let me know if there's anything else I can do to help, otherwise it seems like this is a closed issue!

puremourning commented 7 years ago

Glad it is resolved. Technically, we only support using the version of libclang that install.py downloads. Closing this as i think the issue is resolved.

Bothari commented 7 years ago

Thanks again for your advice. I'll admit I've never had any luck with getting install.py to work, hence why I build it manually. Perhaps I'll try digging around with that and see what my issues are.