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

vim crash with latest vim8、YCM、python3.6.3(pyenv) on CentOS #2855

Closed iFanze closed 6 years ago

iFanze commented 6 years ago

I've searched for the solution for a long time, most of them were caused by python installed by brew on macOS. None of them works for me.

I did following things:

export PYTHON_CONFIGURE_OPTS="--enable-shared"
pyenv install -v 3.6.3
pyenv global 3.6.3
git clone xxxx
./configure --enable-multibyte \
            --enable-python3interp=yes \
            --with-python3-config-dir=~/.pyenv/versions/3.6.3/lib/python3.6/config-3.6m-x86_64-linux-gnu \
            --enable-cscope
make
make install
cd ~/.vim/bundle/YouCompleteMe
./install --clang-completer

All done with success.

    linux-vdso.so.1 =>  (0x00007ffd0f3bf000)
    libpython3.6m.so.1.0 => /home/fanze/.pyenv/versions/3.6.3/lib/libpython3.6m.so.1.0 (0x00007f99cf788000)
    libclang.so.5 => /home/fanze/.vim/bundle/YouCompleteMe/third_party/ycmd/libclang.so.5 (0x00007f99cbd00000)
    librt.so.1 => /lib64/librt.so.1 (0x00007f99cbaef000)
    libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f99cb7e7000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f99cb4e4000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f99cb2ce000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f99caf0b000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f99cacee000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f99caaea000)
    libutil.so.1 => /lib64/libutil.so.1 (0x00007f99ca8e7000)
    libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007f99ca6bc000)
    libz.so.1 => /lib64/libz.so.1 (0x00007f99ca4a6000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f99d00aa000)

libpython.so seems to be OK.

But, when I run vim, it will crash with message:

$ vim
Vim: Caught deadly signal ABRT
Vim: Finished.
[1]    31198 abort      vim
                           %                                                                                                                                                      $ ;2R0;95;0c

And it makes the following outputs of my operations mess, unless I reconnect it with ssh.

if I debug it with gdb vim, it shows:

^[[2;2R^[[>0;95;0cFatal Python error: PyThreadState_Get: no current thread

Program received signal SIGABRT, Aborted.
0x00007ffff6cd71f7 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc-2.17-196.el7_4.2.x86_64 libselinux-2.5-11.el7.x86_64 ncurses-libs-5.9-14.20130511.el7_4.x86_64 pcre-8.32-17.el7.x86_64
(gdb) 2R0;95;0c
(gdb) bt
#0  0x00007ffff6cd71f7 in raise () from /lib64/libc.so.6
#1  0x00007ffff6cd88e8 in abort () from /lib64/libc.so.6
#2  0x00007fffefcb8f5f in Py_FatalError (msg=msg@entry=0x7fffefd61cb0 "PyThreadState_Get: no current thread") at Python/pylifecycle.c:1466
#3  0x00007fffefcbb365 in PyThreadState_Get () at Python/pystate.c:543
#4  0x00007fffefbea5b5 in PyModule_Create2 (module=module@entry=0x7ffff025ec00 <_heapqmodule>, module_api_version=module_api_version@entry=1013) at Objects/moduleobject.c:166
#5  0x00007ffff005b922 in PyInit__heapq () at /tmp/python-build.20171216110243.15826/Python-3.6.3/Modules/_heapqmodule.c:640

If I comment Plugin 'Valloric/YouCompleteMe' in .vimrc, vim works.

micbou commented 6 years ago

I tried with the same configuration in a VM and I get the crash. However, it also crashes when I start Vim without YCM and try to load the Python 3 interpreter:

$ vim -c "py3 pass"
Vim: Caught deadly signal ABRT
Vim: Finished.
Aborted (core dumped)

I fixed the crash by compiling Vim with the --enable-python3interp option set to dynamic and adding the Python library path to LD_LIBRARY_PATH:

$ ./configure --enable-multibyte --enable-python3interp=dynamic --with-python3-config-dir=~/.pyenv/versions/3.6.3/lib/python3.6/config-3.6m-x86_64-linux-gnu/ --enable-cscope
$ make
$ export LD_LIBRARY_PATH=~/.pyenv/versions/3.6.3/lib
iFanze commented 6 years ago

It works, thanks a lot! So vim --version need to be like +python3/dyn insead of +python3, I think.

micbou commented 6 years ago

Seems so.

0k00l commented 4 years ago

Same issue here on Gentoo after latest update. I manage to compile vim with +python3/dyn but it doesn't resolve problem

s3b0@hp ~ $ vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jan 26 2020 07:21:09)
Zadane łaty: 1-114
Zmieniony przez Gentoo-8.2.0114
Skompilowany przez s3b0@hp
Olbrzymia wersja bez GUI.  Opcje włączone (+) lub nie (-):
+acl               -farsi             -mouse_sysmouse    -tag_old_static
+arabic            +file_in_path      +mouse_urxvt       -tag_any_white
+autocmd           +find_in_path      +mouse_xterm       -tcl
+autochdir         +float             +multi_byte        +termguicolors
-autoservername    +folding           +multi_lang        -terminal
-balloon_eval      -footer            -mzscheme          +terminfo
+balloon_eval_term +fork()            +netbeans_intg     +termresponse
-browse            +gettext           +num64             +textobjects
++builtin_terms    -hangul_input      +packages          +textprop
+byte_offset       +iconv             +path_extra        +timers
+channel           +insert_expand     -perl              +title
+cindent           +job               +persistent_undo   -toolbar
+clientserver      +jumplist          +popupwin          +user_commands
+clipboard         +keymap            +postscript        +vartabs
+cmdline_compl     +lambda            +printer           +vertsplit
+cmdline_hist      +langmap           +profile           +virtualedit
+cmdline_info      +libcall           -python            +visual
+comments          +linebreak         +python3/dyn       +visualextra
+conceal           +lispindent        +quickfix          +viminfo
+cryptv            +listcmds          +reltime           +vreplace
-cscope            +localmap          +rightleft         +wildignore
+cursorbind        -lua               -ruby              +wildmenu
+cursorshape       +menu              +scrollbind        +windows
+dialog_con        +mksession         +signs             +writebackup
+diff              +modify_fname      +smartindent       +X11
+digraphs          +mouse             +sound             +xfontset
-dnd               -mouseshape        +spell             -xim
-ebcdic            +mouse_dec         +startuptime       -xpm
+emacs_tags        +mouse_gpm         +statusline        +xsmp_interact
+eval              -mouse_jsbterm     -sun_workshop      +xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary        
       vimrc systemu: "/etc/vim/vimrc"
   vimrc użytkownika: "$HOME/.vimrc"
 2-gi plik vimrc użytkownika: "~/.vim/vimrc"
    exrc użytkownika: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
   odwet dla $VIM-a: "/usr/share/vim"
Kompilacja: x86_64-pc-linux-gnu-gcc -c -I. -Iproto -DHAVE_CONFIG_H     -O2 -pipe -march=corei7 -mtune=corei7 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Konsolidacja: x86_64-pc-linux-gnu-gcc   -Wl,-O1 -L/usr/local/lib -Wl,--as-needed -o vim    -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lelf -lnsl   -lcanberra -lacl -lattr -lgpm -ldl
puremourning commented 4 years ago

@0k00l dont reply with no new diagnostics to a closed issue. If you have a problem and believe that it is a YCM bug (fwiw, this issue is not, it’s an installation of vim/python issue), then raise a new issue and complete the issue template.

bstaletic commented 4 years ago

Just a blind guess, based on my recent interaction with a gentoo user.

vim --noplugins
:py3 pass

I expect this to segfault for you and if it does, it's not a YCM issue.

0k00l commented 4 years ago

@0k00l dont reply with no new diagnostics to a closed issue. If you have a problem and believe that it is a YCM bug (fwiw, this issue is not, it’s an installation of vim/python issue), then raise a new issue and complete the issue template.

Ok - sorry

0k00l commented 4 years ago

Just a blind guess, based on my recent interaction with a gentoo user.

vim --noplugins
:py3 pass

I expect this to segfault for you and if it does, it's not a YCM issue.

Got segfault - so it is not YCM issue

jinzi9800 commented 3 years ago

bash:

vim --version |grep python

echo:

+comments          +libcall           -python            +visual
+conceal           +linebreak         -python3           +visualextra

am I have to re-make Vim? Thank you for your help.

bstaletic commented 3 years ago

Usually the distros package python-enabled vim too.