Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
10 of 12 tasks
MrZhang123 opened this issue Dec 15, 2018 · 26 comments
Closed
10 of 12 tasks

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

MrZhang123 opened this issue Dec 15, 2018 · 26 comments

Comments

@MrZhang123
Copy link

MrZhang123 commented Dec 15, 2018

Issue Prelude

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

  • I have read and understood YCM's [CONTRIBUTING][cont] document.
  • I have read and understood YCM's [CODE_OF_CONDUCT][code] document.
  • I have read and understood YCM's [README][readme], especially the
    [Frequently Asked Questions][faq] section.
  • 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])
  • 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.
  • 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
  • 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.
  • 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 root@apple.com
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 ?

@bstaletic
Copy link
Collaborator

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?

@MrZhang123
Copy link
Author

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

@bstaletic
Copy link
Collaborator

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.

@MrZhang123
Copy link
Author

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

@bstaletic
Copy link
Collaborator

What about :py import threading?

@MrZhang123
Copy link
Author

@bstaletic Nothing happened

@MrZhang123
Copy link
Author

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

@puremourning
Copy link
Member

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

@MrZhang123
Copy link
Author

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

@puremourning
Copy link
Member

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.

@MrZhang123
Copy link
Author

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

@puremourning
Copy link
Member

@MrZhang123
Copy link
Author

@puremourning ok, I'm in

@puremourning
Copy link
Member

puremourning commented Dec 15, 2018

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.

@puremourning
Copy link
Member

It seems we're not the only ones seeing MemoryError on Mojave python in Vim:

powerline/powerline#1947

Note also, duplicates

#3165
#3200

@puremourning
Copy link
Member

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

@puremourning
Copy link
Member

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

@puremourning
Copy link
Member

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.

@droghio
Copy link

droghio commented Dec 15, 2018

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.

@puremourning
Copy link
Member

@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

@boxi79
Copy link

boxi79 commented Dec 17, 2018

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

@miallo
Copy link

miallo commented Dec 19, 2018

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 😉

@puremourning
Copy link
Member

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.

@hp685
Copy link

hp685 commented Jan 6, 2019

This occurs only when installing YCM, in my case. If I remove YCM plugin from .vimrc, vim comes up fine. powerline/powerline#1947 (comment) helped address it.

@micbou
Copy link
Collaborator

micbou commented Feb 26, 2019

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

@henryiii
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants