Closed manumart closed 3 years ago
None of the other plugins can cause this bug. Only the R package nvimcom
which is part of Nvim-R
can cause a segmentation fault in R because nvimcom
has C code. Could you, please, put the line below in your init.vim
to run R
within gdb
?
let R_args = ['--quiet', '--no-save', '-d', 'gdb']
Then, when you do <LocalLeader>rf
gdb
will be started instead of R
and you will have to type r
and press enter to actually start R. Gdb should show the exact line of C code where R crashes. After finishing the R session, you have to type q
to quit gdb
. Of course, gdb
must be installed.
If using gdb
does not prove to be useful in this case, running R within valgrind
would be the next step:
let R_args = ['--quiet', '--no-save', '--debugger=valgrind']
Thank you very much for the quick feedback (on top of all the tremendous work on Nvim-R).
gdb returns :
read 1 "R" received signal SIGSEGV, Segmentation fault. 0x00007ffff78c1b40 in TYPEOF () from /usr/lib/R/lib/libR.so
valgrind gives me :
==7249== Invalid read of size 1 ==7249== at 0x4FABB40: TYPEOF (in /usr/lib/R/lib/libR.so) ==7249== by 0x1042A587: nvimcom_glbnv_line (nvimcom.c:403) ==7249== by 0x1042B229: nvimcom_globalenv_list.part.1 (nvimcom.c:550) ==7249== by 0x1042B5D6: nvimcom_globalenv_list (nvimcom.c:745) ==7249== by 0x1042B5D6: nvimcom_exec (nvimcom.c:748) ==7249== by 0x4F19ED8: R_ToplevelExec (in /usr/lib/R/lib/libR.so) ==7249== by 0x104293A9: nvimcom_uih (nvimcom.c:763) ==7249== by 0x5092212: R_runHandlers (in /usr/lib/R/lib/libR.so) ==7249== by 0x509262D: ??? (in /usr/lib/R/lib/libR.so) ==7249== by 0x4FA7AD3: Rf_ReplIteration (in /usr/lib/R/lib/libR.so) ==7249== by 0x4FA7FC0: ??? (in /usr/lib/R/lib/libR.so) ==7249== by 0x4FA8077: run_Rmainloop (in /usr/lib/R/lib/libR.so) ==7249== by 0x10883A: main (in /usr/lib/R/bin/exec/R) ==7249== Address 0x12c is not stack'd, malloc'd or (recently) free'd ==7249==
Hope this helps. Please let me know if you need additional tests.
It seems that an object in R's workspace classified as function
is an unconventional type of function, but I can't replicate the issue. Does the crash happen with any script or could you isolate either a package or a sample code that would trigger it?
Hi and thank you very much for investigating this. In fact I had created a global variable with the sum function in it, for a later use in an apply call. Here is a minimalistic example to reproduce the problem on my computer :
GLOB_VAR <- sum; dfe <- data.frame(a = 1:10, b = 1:10); apply(dfe, 2, GLOB_VAR)
This caused the segfault while Ctrl-X Ctrl-O with nvim and nvim-R. Actually it even causes segfault while
For now I no longer use this global variable, so my code is OK and I can keep using Nvim-R normally, but I would be interested to know if it is a Nvim-R or Nvim problem.
Thank you in advance, Manuel
@manumart, I could finally replicate the issue and it is fixed now. Thanks for finding a way of replicating it!
When I try to activate omni-completion in insert mode, I get a segFault error :
caught segfault address 0x55f90000012c, cause 'memory not mapped'
Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace
I am using nvim v0.4.3 (Ubuntu 18.04), with the following plugins :
call plug#begin() "Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'SirVer/ultisnips' Plug 'honza/vim-snippets' "Plug 'brooth/far.vim' " multiple search and replaces Plug 'scrooloose/nerdTree' Plug 'vim-pandoc/vim-pandoc' Plug 'vim-pandoc/vim-pandoc-syntax' "Plug 'Shougo/denite.nvim' Plug 'jalvesaq/zotcite' Plug 'jalvesaq/Nvim-R' "Plug 'easymotion/vim-easymotion' Plug 'simnalamburt/vim-mundo' "Plug 'ncm2/ncm2' "Plug 'roxma/nvim-yarp' "Plug 'tpope/vim-surround' "Plug 'ctrlpvim/ctrlp.vim' "Plug 'Asheq/close-buffers.vim' "Plug 'gaalcaras/ncm-R' "" colorschemes """""""""""""""" "Plug 'rakr/vim-one' Plug 'bling/vim-airline' ""Plug 'itchyny/lightline.vim' " Lightweight powerline/airline clone. Plug 'vim-airline/vim-airline-themes' Plug 'ayu-theme/ayu-vim' " or other package manager set termguicolors " enable true colors support let ayucolor="light" " for light version of theme let ayucolor="mirage" " for mirage version of theme let ayucolor="dark" " for dark version of theme colorscheme ayu "Plug 'morhetz/gruvbox' call plug#end()
Thank you in advance, Manuel