Youcompleteme: Vim: Caught deadly signal SEGV (macOS)

Created on 28 May 2017  路  9Comments  路  Source: ycm-core/YouCompleteMe

Issue Prelude

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

  • [X] I have read and understood YCM's CONTRIBUTING document.
  • [X] I have read and understood YCM's CODE_OF_CONDUCT document.
  • [X] I have read and understood YCM's README, especially the
    Frequently Asked Questions section.
  • [X] I have searched YCM's issue tracker to find issues similar to the one I'm
    about to report and couldn't find an answer to my problem. (Example Google
    search.
    )
  • [X] If filing a bug report, I have included the output of vim --version.
  • [ ] If filing a bug report, I have included the output of :YcmDebugInfo.
  • [ ] If filing a bug report, I have attached the contents of the logfiles using
    the :YcmToggleLogs command.
  • [X] If filing a bug report, I have included which OS (including specific OS
    version) I am using.
  • [ ] If filing a bug report, I have included a minimal test case that reproduces
    my issue, including what I expected to happen and what actually happened.
  • [ ] If filing a installation failure report, I have included the entire output
    of install.py (or cmake/make/ninja) including its invocation
  • [x] I understand this is an open-source project staffed by volunteers and
    that any help I receive is a selfless, heartfelt _gift_ of their free time. I
    know I am not entitled to anything and will be polite and courteous.
  • [x] I understand my issue may be closed if it becomes obvious I didn't
    actually perform all of these steps.

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:

  • What did you do?

I upgraded vim to 8, and then vim started to crash.
So I removed '.vim/bundle/YouCompleteMeand tried to reinstall it but vim crashed again whilePluginInstall`.

Include steps to reproduce here.

$ vim

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

  • What did you expect to happen?

vim starts

Include description of the expected behaviour.

  • What actually happened?

vim crashed with

Vim: Caught deadly signal SEGV
Vim: Finished.

Segmentation fault: 11

Include description of the observed behaviour, including actual output,
screenshots, etc.

Diagnostic data

Output of vim --version

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled May 26 2017 00:02:05)
MacOS X (unix) version
Included patches: 1-596
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl             +find_in_path    -mouse_sysmouse  -tag_any_white
+arabic          +float           +mouse_urxvt     +tcl
+autocmd         +folding         +mouse_xterm     +termguicolors
+balloon_eval    -footer          +multi_byte      +terminfo
+browse          +fork()          +multi_lang      +termresponse
++builtin_terms  +fullscreen      -mzscheme        +textobjects
+byte_offset     -gettext         +netbeans_intg   +timers
+channel         -hangul_input    +num64           +title
+cindent         +iconv           +odbeditor       +toolbar
+clientserver    +insert_expand   +packages        +transparency
+clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        +perl            +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       +python          +vreplace
+cscope          +lispindent      -python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con_gui  -lua             +rightleft       +writebackup
+diff            +menu            +ruby            -X11
+digraphs        +mksession       +scrollbind      -xfontset
+dnd             +modify_fname    +signs           +xim
-ebcdic          +mouse           +smartindent     -xpm
+emacs_tags      +mouseshape      +startuptime     -xsmp
+eval            +mouse_dec       +statusline      -xterm_clipboard
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax
+farsi           +mouse_netterm   +tag_binary
+file_in_path    +mouse_sgr       +tag_old_static
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X_UNIX  -F/Library/Frameworks -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -L/usr/local/lib -L. -L/usr/local/lib -F/Library/Frameworks -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -lpython2.7 -framework CoreFoundation -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm  -lncurses -liconv -framework Cocoa   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl -F/Library/Frameworks -framework Python  -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation -framework Ruby

Place the output here, or a link to a gist.

Output of YcmDebugInfo

Place the output here, or a link to a gist.

Contents of YCM, ycmd and completion engine logfiles

Include link here to a gist containing the entire logfiles for ycm, ycmd
and any completer logfiles listed by :YcmToggleLogs.

OS version, distribution, etc.

macOS Sierra
10.12.5 (16F73)

Include system information here.

Output of build/install commands

Include link to a gist containing the invocation and entire output of
install.py if reporting an installation issue.

Most helpful comment

I reverted to the crashing situation and ran brew upgrade python && brew cleanup python:

~~~
brew upgrade python && brew cleanup python ~
==> Upgrading 1 outdated package, with result:
python 2.7.13_1
==> Upgrading python
==> Downloading https://homebrew.bintray.com/bottles/python-2.7.13_1.el_capitan.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/0d/0d2238ff1c7e21ebf87c201655d0b85b34473a78d56188b014f0bc43fd617efa?__gda__=exp=1502890381~hmac=589ecf0f6c4c0c23

################################################################## 100.0%

==> Pouring python-2.7.13_1.el_capitan.bottle.tar.gz
==> /usr/local/Cellar/python/2.7.13_1/bin/python2 -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --record=installed.txt
==> /usr/local/Cellar/python/2.7.13_1/bin/python2 -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --record=installed.txt
==> /usr/local/Cellar/python/2.7.13_1/bin/python2 -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --record=installed.txt
==> Caveats
This formula installs a python2 executable to /usr/local/bin.
If you wish to have this formula's python executable in your PATH then add
the following to ~/.zshrc:
export PATH="/usr/local/opt/python/libexec/bin:$PATH"

Pip and setuptools have been installed. To update them
pip2 install --upgrade pip setuptools

You can install Python packages with
pip2 install

They will install into the site-package directory
/usr/local/lib/python2.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python.html
==> Summary
馃嵑 /usr/local/Cellar/python/2.7.13_1: 3,532 files, 48.1MB
Removing: /usr/local/Cellar/python/2.7.12_2... (3,687 files, 49.5MB)
Removing: /usr/local/Cellar/python/2.7.13... (3,747 files, 50.9MB)
==> This operation has freed approximately 100.4MB of disk space.
~~~

then I rebuild macvim:

~
$ brew uninstall macvim
Uninstalling /usr/local/Cellar/macvim/8.0-136... (2,140 files, 33.9MB)
$ brew uninstall macvim
Error: No such keg: /usr/local/Cellar/macvim
$ brew install python
Warning: python 2.7.13_1 is already installed
$ brew install macvim --with-override-system-vim --with-lua --without-cscope
==> Downloading https://github.com/macvim-dev/macvim/archive/snapshot-136.tar.gz
Already downloaded: /Users/sirver/Library/Caches/Homebrew/macvim-8.0-136.tar.gz
==> ./configure --with-features=huge --enable-multibyte --with-macarchs=x86_64 --enable-perlinterp --enable-rubyinterp --enable-tclinterp --with-tlib=ncurses --
==> make
馃嵑 /usr/local/Cellar/macvim/8.0-136: 2,140 files, 33.9MB, built in 1 minute 1 second
~

And now the crash is gone. I like your theory about macvim linking one of the older installed pythons instead.

My path does not contain anything special for homebrew, so I use system python when I type python.

All 9 comments

After I reinstall macvim (by homebrew), it works now.
Vim version seems to be changed:

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled May 25 2017 08:55:37)
MacOS X (unix) version
Included patches: 1-604

I have the same issue now with MacVim 8.0-136. As soon as I comment out Plug 'Valloric/YouCompleteMe' I get the sigsev. Also Mac Os X.

Funnily enough I did not build YouCompleteMe yet (fresh checkout). Any pointers are appreciated.

Hey @SirVer, could you just confirm repro steps?

  • instal macvim 8.0-136
  • plug YCM (but don't build it)
  • start macvim

?

If so I'll check it out.

OK so those steps don't reproduce for me.

Do you have homebrew python by the way. I find that seems to frequently cause Vim to crash on macOS.

I often recommend using system python and brew unlink python and rebuild YCM. This seems to solve 90% of Vim crashes when using YCM on macOS.

Then again I've just tried a bunch of such combinations and I can't repro.

Yes, the steps in https://github.com/Valloric/YouCompleteMe/issues/2666#issuecomment-322594808 basically reproduce for me. More precisely, this is the minimal repro case for me:

~
$ rm -rf ~/.vim ~/.vimrc ~/.gvimrc
$ cat > ~/.vimrc << EOF
set nocompatible
call plug#begin("~/.vim_bundle")
Plug 'Valloric/YouCompleteMe'
call plug#end()
filetype plugin indent on
syntax enable
EOF
$ curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
$ vim # then run :PlugInstall.
~

This clones a lot of stuff for Ycm, then dies when it tries to load the plugins. Full output in this gist.

Do you have homebrew python by the way. I find that seems to frequently cause Vim to crash on macOS.

Yes I do. I have UltiSnips which requires python too though and this seems to not be an issue. However after doing what you suggested, the error indeed went away. Thank you!

Yes I do. I have UltiSnips

I thought you might! :)

However after doing what you suggested, the error indeed went away. Thank you!

Glad to help! That said, I'm still curious why YCM's python code caused crashes but UltiSnips for example didn't. It's possible there is some vestigal python2/3 stuff going on and we do load quite a lot of dependencies etc.

I'll try your steps when I have some time to see if I can bottom it out. If you could possibly share the version of "brew" python you have and whether or not you add it to your path (i think it suggests adding something like /opt/homebrew/something/python/libexec/bin to your path), that would really help.

I reverted to the crashing situation and ran brew upgrade python && brew cleanup python:

~~~
brew upgrade python && brew cleanup python ~
==> Upgrading 1 outdated package, with result:
python 2.7.13_1
==> Upgrading python
==> Downloading https://homebrew.bintray.com/bottles/python-2.7.13_1.el_capitan.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/0d/0d2238ff1c7e21ebf87c201655d0b85b34473a78d56188b014f0bc43fd617efa?__gda__=exp=1502890381~hmac=589ecf0f6c4c0c23

################################################################## 100.0%

==> Pouring python-2.7.13_1.el_capitan.bottle.tar.gz
==> /usr/local/Cellar/python/2.7.13_1/bin/python2 -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --record=installed.txt
==> /usr/local/Cellar/python/2.7.13_1/bin/python2 -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --record=installed.txt
==> /usr/local/Cellar/python/2.7.13_1/bin/python2 -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --record=installed.txt
==> Caveats
This formula installs a python2 executable to /usr/local/bin.
If you wish to have this formula's python executable in your PATH then add
the following to ~/.zshrc:
export PATH="/usr/local/opt/python/libexec/bin:$PATH"

Pip and setuptools have been installed. To update them
pip2 install --upgrade pip setuptools

You can install Python packages with
pip2 install

They will install into the site-package directory
/usr/local/lib/python2.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python.html
==> Summary
馃嵑 /usr/local/Cellar/python/2.7.13_1: 3,532 files, 48.1MB
Removing: /usr/local/Cellar/python/2.7.12_2... (3,687 files, 49.5MB)
Removing: /usr/local/Cellar/python/2.7.13... (3,747 files, 50.9MB)
==> This operation has freed approximately 100.4MB of disk space.
~~~

then I rebuild macvim:

~
$ brew uninstall macvim
Uninstalling /usr/local/Cellar/macvim/8.0-136... (2,140 files, 33.9MB)
$ brew uninstall macvim
Error: No such keg: /usr/local/Cellar/macvim
$ brew install python
Warning: python 2.7.13_1 is already installed
$ brew install macvim --with-override-system-vim --with-lua --without-cscope
==> Downloading https://github.com/macvim-dev/macvim/archive/snapshot-136.tar.gz
Already downloaded: /Users/sirver/Library/Caches/Homebrew/macvim-8.0-136.tar.gz
==> ./configure --with-features=huge --enable-multibyte --with-macarchs=x86_64 --enable-perlinterp --enable-rubyinterp --enable-tclinterp --with-tlib=ncurses --
==> make
馃嵑 /usr/local/Cellar/macvim/8.0-136: 2,140 files, 33.9MB, built in 1 minute 1 second
~

And now the crash is gone. I like your theory about macvim linking one of the older installed pythons instead.

My path does not contain anything special for homebrew, so I use system python when I type python.

@SirVer I am getting -

Error: invalid option: --with-override-system-vim

Was this page helpful?
0 / 5 - 0 ratings