Youcompleteme: Update macOS Mojave 10.14.2, terminal VIm:Caught deadly signal SEGV

Created on 15 Dec 2018  路  26Comments  路  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][cont] document.
  • [x] I have read and understood YCM's [CODE_OF_CONDUCT][code] document.
  • [x] I have read and understood YCM's [README][readme], especially the
    [Frequently Asked Questions][faq] 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.][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.
  • [x] 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.
  • [x] 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

I upgrade macOS Mojave for 10.14.2, and install last version YouCompleteMe, then run ./install.py --ts-completer, every things is ok, when i run $ vim ,I get error like this:

Vim: Caught deadly signal SEGV
Error detected while processing function <SNR>91_PollServerReady[7]...<SNR>91_Pyeval: Vim: Finished.


line   4:
Exception MemoryError: MemoryError() in <module 'threading' from '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.pyc> ignored [1] .  36295 segmentation fault vim

if i remove YCM, everything is ok, but when i installed it ,I get problem. This problem only have in terminal vim , macvim is ok,
my terminal vim is macos default vim , not use brew install vim and vim --version is

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Aug 17 2018 17:24:51)

Diagnostic data

Output of vim --version

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Aug 17 2018 17:24:51)
Included patches: 1-503, 505-680, 682-1283
Compiled by [email protected]
Normal version without GUI.  Features included (+) or not (-):
+acl             +file_in_path    -mouse_sgr       +tag_old_static
-arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           -mouse_urxvt     -tcl
-balloon_eval    +folding         +mouse_xterm     -termguicolors
-browse          -footer          +multi_byte      -terminal
+builtin_terms   +fork()          +multi_lang      +terminfo
+byte_offset     -gettext         -mzscheme        +termresponse
+channel         -hangul_input    +netbeans_intg   +textobjects
+cindent         +iconv           +num64           +timers
-clientserver    +insert_expand   +packages        +title
-clipboard       +job             +path_extra      -toolbar
+cmdline_compl   +jumplist        -perl            +user_commands
+cmdline_hist    -keymap          +persistent_undo +vertsplit
+cmdline_info    +lambda          +postscript      +virtualedit
+comments        -langmap         +printer         +visual
-conceal         +libcall         -profile         +visualextra
+cryptv          +linebreak       +python/dyn      +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      -lua             -rightleft       +windows
+diff            +menu            +ruby/dyn        +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
-emacs_tags      -mouseshape      +startuptime     -xpm
+eval            -mouse_dec       +statusline      -xsmp
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_clipboard
+extra_search    -mouse_jsbterm   +syntax          -xterm_save
-farsi           -mouse_netterm   +tag_binary
   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: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L/usr/local/lib -o vim        -lm -lncurses  -liconv -framework Cocoa

I wonder why this happened and how to fix it ?

Most helpful comment

Had the same issue with the System Vim but as @boxi79 reported: with the homebrew version everything is fine

@MrZhang123 If you have future trouble with your configuration of vim (i.e. plugins that are failing) you can use vim -u NONE. This will stop it from loading your .vimrc at startup and you don't have to uninstall the plugin for vim to work 馃槈

All 26 comments

We've had tons of reports of broken vim/python on macos, so let's start from there.
Can you do :py print(1) in your terminal vim?

@bstaletic sorry, I can't , because when i run $ vim in my terminal vim , it will shut down Immediately and print error log.

If that is happening even without YCM, then that is definitely not caused by YCM.
I meant try that command without YCM there to cause a segfault.

@bstaletic Yea, I remove YCM and run :py print(1) , it work and print 1.

What about :py import threading?

@bstaletic Nothing happened

@bstaletic Why does this happen ? Maybe when i update OS, environment variable change and YCM get error ? or others ?

What is the output of which python In the shell that u used to build YCM ?

@puremourning I input which python in my terminal and output /usr/bin/python

Are you able to join our Gitter channel? It might be easier to debug interactively? There are a few steps I would like to check through that would be easier in a chat.

@puremourning yeah, I can, what Gitter channel's name ?

@puremourning ok, I'm in

I can reproduce this with system Vim on Mojave.

(ycmd-system) BenMBP:ycmd ben$ /usr/bin/vim
Vim: Caught deadly signal SEGV
Error detected while processing function <SNR>106_PollServerReady[7]..<SNR>106_Pyeval:Vim: Finished.

line    4:
Exception MemoryError: MemoryError() in <module 'threading' from '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.pyc'> ignored

Historically, system Vim has not been new enough to run YCM so most users use homebrew or MacVim. It's highly possible that this is some incompatibility or nonstandard build of Vim supplied in the OS. It wouldn't be the first time.

Our readme still says to use MacVim, so I would recommend doing that. Alternatively, homebrew Vim (e.g. --with-override-system-vim) is known to work.

I can repro without using any YCM code. The error happens when instantiating python requests-futures:

py << EOF

from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import

import os.path as p

root_folder = '/Users/ben/.vim/bundle/YouCompleteMe-Clean'
third_party_folder = p.join( root_folder, 'third_party' )

# Add dependencies to Python path.
dependencies = [ p.join( third_party_folder, 'requests-futures' ),
                 p.join( third_party_folder, 'requests_deps', 'idna' ),
                 p.join( third_party_folder, 'requests_deps', 'chardet' ),
                 p.join( third_party_folder,
                         'requests_deps',
                         'urllib3',
                         'src' ),
                 p.join( third_party_folder, 'requests_deps', 'certifi' ),
                 p.join( third_party_folder, 'requests_deps', 'requests' ) ]

# The concurrent.futures module is part of the standard library on Python 3.
if sys.version_info[ 0 ] == 2:
  dependencies.append( p.join( third_party_folder, 'pythonfutures' ) )

sys.path[ 0:0 ] = dependencies

from requests_futures.sessions import FuturesSession
session = FuturesSession()
EOF

repro with /usr/bin/vim -Nu that_file.vim

actually it happens importing requests

py << EOF

from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import

import os.path as p

root_folder = '/Users/ben/.vim/bundle/YouCompleteMe-Clean'
third_party_folder = p.join( root_folder, 'third_party' )

# Add dependencies to Python path.
dependencies = [ p.join( third_party_folder, 'requests_deps', 'idna' ),
                 p.join( third_party_folder, 'requests_deps', 'chardet' ),
                 p.join( third_party_folder,
                         'requests_deps',
                         'urllib3',
                         'src' ),
                 p.join( third_party_folder, 'requests_deps', 'certifi' ),
                 p.join( third_party_folder, 'requests_deps', 'requests' ) ]

# The concurrent.futures module is part of the standard library on Python 3.
if sys.version_info[ 0 ] == 2:
  dependencies.append( p.join( third_party_folder, 'pythonfutures' ) )

sys.path[ 0:0 ] = dependencies

import requests
EOF

Interesting. Without __future__, we get the same error as powerline/powerline#1947

bash-3.2$ /usr/bin/vim -Nu test_system_vim.vim 
Error detected while processing /Users/ben/.vim/test_system_vim.vim:
line   25:
Traceback (most recent call last):
  File "<string>", line 23, in <module>
  File "/Users/ben/.vim/bundle/YouCompleteMe-Clean/third_party/requests_deps/requests/requests/__init__.py", line 95, i
n <module>
    from urllib3.contrib import pyopenssl
  File "/Users/ben/.vim/bundle/YouCompleteMe-Clean/third_party/requests_deps/urllib3/src/urllib3/contrib/pyopenssl.py",
 line 46, in <module>
    import OpenSSL.SSL
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/OpenSSL/__init__.py", line 22, in <m
odule>
    import ctypes
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 555, in <modul
e>
    _reset_cache()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 279, in _reset
_cache
    CFUNCTYPE(c_int)(lambda: None)
MemoryError
Press ENTER or type command to continue

This boils down further to:

py << EOF

import os.path as p

root_folder = '/Users/ben/.vim/bundle/YouCompleteMe-Clean'
third_party_folder = p.join( root_folder, 'third_party' )

# Add dependencies to Python path.
dependencies = [ p.join( third_party_folder,
                         'requests_deps',
                         'urllib3',
                         'src' ) ]

sys.path[ 0:0 ] = dependencies

from urllib3.contrib import pyopenssl
EOF

Interestingly, this doesn't cause the segfault, but the memory error is clearly an issue with urllib3/pyopenssl on in that environment.

It's not a YCM issue per se, but I wonder if there is a workaround we might be able to apply.

I can reproduce this with system Vim on Mojave.

(ycmd-system) BenMBP:ycmd ben$ /usr/bin/vim
Vim: Caught deadly signal SEGV
Error detected while processing function <SNR>106_PollServerReady[7]..<SNR>106_Pyeval:Vim: Finished.

line    4:
Exception MemoryError: MemoryError() in <module 'threading' from '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.pyc'> ignored

Historically, system Vim has not been new enough to run YCM so most users use homebrew or MacVim. It's highly possible that this is some incompatibility or nonstandard build of Vim supplied in the OS. It wouldn't be the first time.

Our readme still says to use MacVim, so I would recommend doing that. Alternatively, homebrew Vim (e.g. --with-override-system-vim) is known to work.

Not sure if this is still applicable but I have been able to reproduce the error in MacVim v8.1.557. I installed the plugin using Vundle and if I comment out loading of YouCompleteMe macvim starts up. With it in I get the same Vim: Caught deadly signal SEGV.

Same configuration was working fine on an older version of MacOS but just updated to Mojave 10.14.2 to make my weekend more interesting. I direct YouCompleteMe to use a version of python3 installed using macports instead of the native implementation.

@droghio It's not clear from your report if you are seeing the exact same issue or not. Do you have specific evidence? Can you try the minimal repro here :

(replace /path/to/YouCompleteMe with the correct path)

py << EOF

import os.path as p

root_folder = '/path/to/YouCompleteMe'
third_party_folder = p.join( root_folder, 'third_party' )

# Add dependencies to Python path.
dependencies = [ p.join( third_party_folder,
                         'requests_deps',
                         'urllib3',
                         'src' ) ]

sys.path[ 0:0 ] = dependencies

from urllib3.contrib import pyopenssl
EOF

I update vim by brew install vim --with-override-system-vi --with-lua, and everything works well now.

Had the same issue with the System Vim but as @boxi79 reported: with the homebrew version everything is fine

@MrZhang123 If you have future trouble with your configuration of vim (i.e. plugins that are failing) you can use vim -u NONE. This will stop it from loading your .vimrc at startup and you don't have to uninstall the plugin for vim to work 馃槈

This is not a YCM issue, it's clearly a Vim and/or macOS issue, so closing this. Using Vim or macVim from homerbew is recommended.

This occurs only when installing YCM, in my case. If I remove YCM plugin from .vimrc, vim comes up fine. https://github.com/powerline/powerline/issues/1947#issuecomment-441884283 helped address it.

For posterity, here's a simpler way to reproduce the MemoryError exception without YCM:

:py import ctypes

resulting in

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 555, in <module>
    _reset_cache()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 279, in _reset_cache
    CFUNCTYPE(c_int)(lambda: None)
MemoryError

I update vim by brew install vim --with-override-system-vi --with-lua, and everything works well now.

For posterity (since I just used this to fix my install of youcompleteme), the commands are now:

brew install vim

Or, to include the graphical interface too:

brew install macvim

Brew has removed options from most formula; the --with-override-system-vi and --with-lua options are now part of the default.

Was this page helpful?
0 / 5 - 0 ratings