macvim icon indicating copy to clipboard operation
macvim copied to clipboard

crash

Open voronoi-coder opened this issue 5 years ago • 19 comments

When I updated to 8.1.2234 (161),it crashed. My MAC OS version is 10.14.

Crash Info: Vim: Caught deadly signal SEGV Error detected while processing function <SNR>107_OnVimLeave:Vim: Finished.

line 6: MemoryError

voronoi-coder avatar Nov 09 '19 02:11 voronoi-coder

@hahahJoey Thank you for your issue,

Could you tell us more about your system?

  • Which distribution do you use? GitHub, Homebrew, MacPorts, etc.
  • Please, try with mvim --clean (gvim --clean) to eliminate involvement of your own configuration
  • Please, try with mvim -v --clean (gvim -v --clean) to try it in a terminal.
  • Please, run defaults read org.vim.MacVim | grep 'MM\|SU' to show us MacVim's configuration not exposed to .vimrc configuration file.

eirnym avatar Nov 09 '19 10:11 eirnym

@eirnym Thanks for your reply, I updated it by "check for updates..." in macvim.

I tried with mvim -v --clean. Vim is open correctly.

The result of "defaults read org.vim.MacVim | grep 'MM|SU'": MMAutosaveColumns = 176; MMAutosaveRows = 63; MMCurrentPreferencePane = General; MMTopLeftPoint = "{77, 862}"; "NSWindow Frame SUUpdateAlert" = "388 363 620 392 0 0 1440 877 "; SUEnableAutomaticChecks = 1; SUHasLaunchedBefore = 1; SULastCheckTime = "2019-11-09 10:23:34 +0000"; SUSendProfileInfo = 0;

voronoi-coder avatar Nov 09 '19 10:11 voronoi-coder

Quick note: Updated to 161 yesterday (am on macOS 10.14.6), YouCompleteMe was MemoryError'ing all over the place; I reverted to 157 and my errors disappeared.

rubin55 avatar Nov 12 '19 23:11 rubin55

@hahahJoey Do you have YouCompleteMe too?

@rubin55 do you have more details about the memory errors you are seeing? There used to be another issue (https://github.com/ycm-core/YouCompleteMe/issues/3520) related to app hardening and Python, but it was only in 160, not 161.

ychin avatar Nov 14 '19 08:11 ychin

@ychin Yes, I have.

voronoi-coder avatar Nov 14 '19 08:11 voronoi-coder

Try to download a new version of YCM and recompile it. I built it since installed Catalina a few times.E

eirnym avatar Nov 14 '19 08:11 eirnym

@ychin How can I collect these errors? They just scroll "through" the gui, looks like a backtrace; can I capture it somewhere? Then I'll share!

rubin55 avatar Nov 14 '19 08:11 rubin55

@rubin55 You can find your crash logs in ~/Library/Logs/DiagnosticReports/. Alternatively, you can find them in a built-in macOS app called "Console" as well.

ychin avatar Nov 14 '19 08:11 ychin

Mm, I looked there, no logs for MacVim. Note that It doesn't actually crash, it keeps running, but is unusable due to logs going through the GUI. I'll Try and reproduce now, gimme a sec

rubin55 avatar Nov 14 '19 08:11 rubin55

These errors do not show up in any log and also not in the console. They occur with 161 only, not with 157: Screenshot 2019-11-14 at 09 41 44

Screenshot 2019-11-14 at 09 42 15

rubin55 avatar Nov 14 '19 08:11 rubin55

Oh ok so it literally just ran out of memory because of some bug / issues with the plugin. Can you post an issue on YouCompleteMe? I'm not trying to kick the ball over since I do recognize that the plugin went from working to not working after upgrading MacVim, but I think it could be useful if they could help a little as they probably know much better what the script is doing in those areas.

ychin avatar Nov 14 '19 09:11 ychin

@ychin I checked the existing bug in YCM here https://github.com/ycm-core/YouCompleteMe/issues/3520 . This is the same issue; my logmessages above are identical to the comments by @andy-retailnext here: https://github.com/ycm-core/YouCompleteMe/issues/3520#issuecomment-547582831

I think the issue is not fixed in 161..

rubin55 avatar Nov 14 '19 09:11 rubin55

Hmm, others have reported it fixed it for them though. Can you try this and tell me if you see an error?

:python print("Testing Python")

ychin avatar Nov 14 '19 10:11 ychin

that prints "Testing Python", without issues. I can 100% reproduce this issue with version 161 and YouCompleteMe. My buildarguments for YCM are:

python install.py --system-libclang --clang-completer --cs-completer --go-completer --ts-completer --rust-completer --java-completer

I'll share my .vimrc here:

" Turn off compatible mode.
set nocompatible

" Turn off modeline support.
set nomodeline

" VimPlug section.
call plug#begin('~/.vim/plugged')
Plug 'arcticicestudio/nord-vim'
Plug 'chriskempson/base16-vim'
Plug 'morhetz/gruvbox'
Plug 'myint/syntastic-extras'
Plug 'scrooloose/nerdtree'
Plug 'scrooloose/syntastic'
Plug 'sirver/UltiSnips', { 'tag': '3.2' }
Plug 'tpope/vim-fireplace'
Plug 'tpope/vim-fugitive'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'wkentaro/conque.vim'
Plug 'ycm-core/YouCompleteMe'
Plug 'Shougo/unite.vim'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'Fyrbll/intero-vim'
call plug#end()

" Main options.
syntax on
filetype on
filetype plugin on
filetype indent on
"scriptencoding utf-8

" File encoding settings.
set encoding=utf-8
set fileformat=unix
set fileformats=unix,dos

" Search options.
set ignorecase
set incsearch
set smartcase
set hlsearch

" Only do soft-wraps.
set linebreak
set wrap

" Setup backspace and tab settings.
set backspace=indent,eol,start
set listchars=tab:>-,eol:$
set tabstop=4
set shiftwidth=4
set expandtab

" Set the command, match and statusline.
set showcmd
set showmatch
set showmode
set cmdheight=1
set laststatus=2

" Some performance extras.
set lazyredraw
set ttyfast

" Enable command completion.
set wildmenu
set wildchar=<Tab>
set wildmode=longest:full,list:full
set wildignore=*.swp,*.bak,*.pyc,*.class

" Viminfo settings.
set viminfo='500,f1,:100,/100

" Disable backup files.
set noswapfile
set nobackup
set nowritebackup

" Assume a dark background.
set background=dark

" Set color scheme for terminal.
" colorscheme default

" Enable line-numbers.
set number

" Settings for gvim.
if has('gui_running')
  colorscheme gruvbox
  set lines=40 columns=120
  if has('gui_gtk2')
    set guifont=Hack\ 11
  elseif has('gui_macvim')
    set guifont=PragmataPro\ Mono\ Liga:h16
    set macligatures
    set macmeta
    set guioptions+=T
  elseif has('gui_win32')
    set guifont=Consolas:h10
  endif
endif

" Silence vim.
set noerrorbells visualbell t_vb=
autocmd GUIEnter * set visualbell t_vb=

" Go to last visited line on open.
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g'\"" | endif

" Don't to spaces for tabs in makefiles.
au FileType make set noexpandtab

" Don't create a backup file for crontab edits.
au FileType crontab set nobackup

" Remove unnecessary white space on save.
autocmd BufWritePre * %s/\s\+$//e

" Highlight unnecessary white space.
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$\| \+\ze\t/

" Extra indenting options for shell scripts.
if !exists('b:sh_indent_options')
  let b:sh_indent_options = {}
endif
let b:sh_indent_options['case-statements'] = 0
let b:sh_indent_options['case-breaks'] = 0

"Non-recursive visual mode key mappings for comments.
noremap <silent> ,# :call CommentLineToEnd('# ')<Cr>+
noremap <silent> ,/ :call CommentLineToEnd('// ')<Cr>+
noremap <silent> ," :call CommentLineToEnd('" ')<Cr>+
noremap <silent> ,; :call CommentLineToEnd('; ')<Cr>+
noremap <silent> ,- :call CommentLineToEnd('-- ')<Cr>+
noremap <silent> ,* :call CommentLinePincer('/* ', ' */')<Cr>+
noremap <silent> ,< :call CommentLinePincer('<!-- ', ' -->')<Cr>+

" Navigate windows using alt-arrow-keys.
nmap <silent> <M-Up> :wincmd k<Cr>
nmap <silent> <M-Down> :wincmd j<Cr>
nmap <silent> <M-Left> :wincmd h<Cr>
nmap <silent> <M-Right> :wincmd l<Cr>

" Vertical and horizontal split window.
map <silent> <M-v> :vsplit<Cr>
map <silent> <M-h> :split<Cr>

" Settings for Conque.
map <silent> <M-c> :ConqueTerm cmd.exe<Cr>

" Settings for Unite.
map <silent> <M-f> :Unite -resume -no-split -buffer-name=files -start-insert file<cr>
map <silent> <M-r> :Unite -resume -no-split -buffer-name=recursive -start-insert file_rec<cr>
map <silent> <M-b> :Unite -resume -no-split -buffer-name=buffer buffer<Cr>
call unite#filters#matcher_default#use(['matcher_fuzzy'])
autocmd FileType unite call s:unite_keymaps()
function! s:unite_keymaps()
    map <buffer> <Esc>   <Plug>(unite_exit)
endfunction`

" Settings for NERDTree.
map <silent> <M-n> :NERDTreeToggle<Cr>
autocmd VimEnter * silent NERDTree | wincmd p
autocmd VimEnter * NERDTreeToggle
let g:NERDTreeQuitOnOpen = 1
let g:NERDTreeMinimalUI = 1
let g:NERDTreeDirArrows = 1
let g:NERDTreeIgnore=['^NTUSER\.DAT.*$']
"let g:NERDTreeDirArrowExpandable = '→'
"let g:NERDTreeDirArrowCollapsible = '↓'
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
let g:NERDTreeIndicatorMapCustom = {
    \ 'Modified'  : '✹',
    \ 'Staged'    : '✚',
    \ 'Untracked' : '✭',
    \ 'Renamed'   : '➜',
    \ 'Unmerged'  : '═',
    \ 'Deleted'   : '✖',
    \ 'Dirty'     : '✗',
    \ 'Clean'     : '✓',
    \ 'Unknown'   : '?'
    \ }

" Settings for Syntastic.
map <silent> <M-s> :SyntasticCheck<Cr> :SyntasticToggleMode<Cr>
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_java_checkers = []
let g:syntastic_mode_map = { 'mode': 'passive', 'active_filetypes': [],'passive_filetypes': [] }

" Settings for Airline.
let g:airline_theme = 'gruvbox'
let g:airline_powerline_fonts = 1

" Settings for ConqueTerm.
let g:ConqueTerm_StartMessages = 0

" Settings for UltiSnips.
nmap <silent> <M-u> :UltiSnipsEdit<Cr>
let g:UltiSnipsUsePythonVersion = 2
if has('unix')
    let g:UltiSnipsSnippetsDir = '/home/rubin/.vim/snippets'
    let g:UltiSnipsSnippetDirectories=['/home/rubin/VimFiles/snippets']
elseif has('win32')
    let g:UltiSnipsSnippetsDir = 'C:/Users/rubin/.vim/snippets'
    let g:UltiSnipsSnippetDirectories=['C:/Users/rubin/VimFiles/snippets']
endif
let g:UltiSnipsEnableSnipMate = 0
let g:UltiSnipsListSnippets = '<M-u>'
let g:UltiSnipsEditSplit= 'vertical'

" Settings for YouCompleteMe.
let g:ycm_key_invoke_completion = '<C-Space>'
let g:ycm_key_list_select_completion = ['<Down>']
let g:ycm_key_list_previous_completion = ['Up']
let g:ycm_autoclose_preview_window_after_completion = 1
let g:ycm_filetype_blacklist = {
      \ 'html' : 1,
      \ 'infolog' : 1,
      \ 'mail' : 1,
      \ 'markdown' : 1,
      \ 'notes' : 1,
      \ 'pandoc' : 1,
      \ 'pom' : 1,
      \ 'qf' : 1,
      \ 'tagbar' : 1,
      \ 'text' : 1,
      \ 'unite' : 1,
      \ 'vimwiki' : 1,
      \ 'xml' : 1
      \}


" Fullscreen enablement for Windows or Mac gvim.
"map <F11> <Esc>:call libcallnr('gvimfullscreen.dll', 'ToggleFullScreen', 0)<Cr>
map <F11> :set invfu

" Toggle distraction free mode in gvim.
map <M-d> <Esc>:call ToggleDistractionFree()<cr>
function! ToggleDistractionFree()
    let l:menu_option = strridx(&guioptions, 'm')
    let l:toolbar_option = strridx(&guioptions, 'T')
    let l:scrollbar_left_option = strridx(&guioptions, 'L')
    let l:scrollbar_right_option = strridx(&guioptions, 'r')
    if l:menu_option > 0
        set guioptions-=m
    else
        set guioptions+=m
    endif
    if l:toolbar_option > 0
        set guioptions-=T
    else
        set guioptions+=T
    endif
    if l:scrollbar_left_option > 0
        set guioptions-=L
    else
        set guioptions+=L
    endif
    if l:scrollbar_right_option > 0
        set guioptions-=r
    else
        set guioptions+=r
    endif
endfunction
call ToggleDistractionFree()

rubin55 avatar Nov 14 '19 13:11 rubin55

@rubin55 as it's documented, YCM is not really compatible with System Clang and they doesn't provide any support with it. I took this warning seriously and always use an internal version. They update library quite often and I have no problems at work where we use the latest C++ features.

eirnym avatar Nov 14 '19 21:11 eirnym

@ychin Recent Xcode update may be related, but I'm not sure about this

Zrzut ekranu 2019-11-15 o 11 40 27

eirnym avatar Nov 15 '19 10:11 eirnym

@rubin55 Sorry I couldn't repro the bug and with how big a plugin YCM is (in particular in requires custom build steps), I may not not be hitting the same situation as you are. Can you post on https://github.com/ycm-core/YouCompleteMe/issues/3520 (or re-open the issue) and ask for help there? As I said, the original (and others) poster said 161 fixed the issue, so it could be a different issue. If you can run Python in MacVim then that seems like something else

ychin avatar Nov 17 '19 04:11 ychin

I am also on Mojave. I did not see a full crash dump in this bug report so I have included one at the bottom of this post. Contrary to an earlier post, the MemoryError exceptions from Python are not indicative of an OOM condition; rather, a segfault is being triggered when that Python code is evaluated.

The report filed against ycm-core was made by a user on Catalina, and the problem in their report clearly manifested with different symptoms. That user later posted a follow-up to say that everything was OK, but again, they are on Catalina, not Mojave.

Has anyone managed to use YCM on MacVim Snapshot 161 on Mojave?

Reverting to Snapshot 157 -- with no changes to the YCM plugin -- is enough to work around this problem. (Snapshot 159 also works with YCM, though there is a a spell bug in that release.) I had planned to debug this problem in more depth late last week, however work commitments called, and I was forced to revert. I think the next step would be to reduce the problem space down to a minimal Python repro case in order to prove that YCM is not at fault.

Crash dump - https://gist.github.com/saj/cf01beaf83edb09086dd1612a6b053ac

saj avatar Dec 03 '19 02:12 saj

I want to add some comments on this thread becouse I was facing this same problem. I was stucked at version 8.1 (patches 1-1722) and unable to upgrade. Today I spent some time investigating the problem and found a solution that worked for me and can work for others too.

I thing everything started becouse of compiled python versions on MacVim. Until patch 1722, Macvim was compiled to support only Python 3. After that, MacVim was made available with Python 2 and 3 (+python/dyn and +python3/dyn). But that was not the real problem. The real problem was my personal .vimrc configuration that was testing for python availability using has('python') Vim function. With that, Python 2 (first available in my system that is a MacOS Mojave 10.14.6) was loaded, causing the memory errors in YCM. What I did was recompile YCM using Python 3, installed via HomeBrew, and removed the has('python') instruction from my .vimrc configuration file.

Today I'm using MacVim 8.1 (patches 1-2234) without the related problems.

I hope this may help someone.

aantonello avatar Jan 22 '20 17:01 aantonello