antoinemadec / coc-fzf

fzf :heart: coc.nvim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nvim crashes on "CocFzfList symbols" after commit 2d9deb2a3b05a0c09f01edda0a4abd542cb3eebd

r7vme opened this issue · comments

commented

Environment

  • echo $FZF_DEFAULT_OPTS: ""
  • bat --version: bat 0.18.3
  • Are your vim plugins up-to-date?: yes
  • (n)vim --version:
NVIM v0.5.1
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/build/neovim/src/neovim-0.5.1/build/config -I/build/neovim/src/neovim-0.5.1/src -I/usr/include -I/build/neovim/src/neovim-0.5.1/build/src/nvim/auto -I/build/neovim/src/neovim-0.5.1/build/include
Compiled by builduser

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

My plugins (neoclide/coc.nvim bug reproduces both on master and release)

call plug#begin('~/.config/nvim/plugged')                                                                                                                                                                                             
Plug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'yarn install --frozen-lockfile'}                                                                                                                                                
Plug 'junegunn/fzf.vim'                                                                                                                                                                                                               
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }                                                                                                                                                                                   
Plug 'antoinemadec/coc-fzf', {'branch': 'release'}                                                                                                                                                                                                                                                                                                                                                                                             
call plug#end()   

Describe the Bug

More like raise awareness than bug in coc-fzf.

I see constant crashes with free(): double free detected in tcache 2 [1] 81777 abort (core dumped) nvim tmp/1.cpp, when CocFzfList symbols executed for at least two times. I was able to localize bug to this commit 2d9deb2 . When I revert this commit all works fine.

After playing around I think the problem in call to coc#util#get_config('list.source.symbols'). So I decided to try to update coc.nvim to master branch. It seems fixes the problem.

In short, workarounds:

  1. git revert 2d9deb2a3b05a0c09f01edda0a4abd542cb3eebd
  2. or use master branch of coc.nvim Plug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'yarn install --frozen-lockfile'} (Does not really help)

To Reproduce

Minimal vimrc

See above.

Steps to Reproduce

1.cpp

int main()
{
  return 1;
}
  1. nvim 1.cpp
  2. CocFzfList symbols then enter
  3. CocFzfList symbols then enter
  4. wait 2-3 secods
  5. crash with free(): double free detected in tcache 2 [1] <PID> abort (core dumped) nvim 1.cpp

Expected Behavior

No crashes on CocFzfList symbols

More info

I use Arch linux, but I also see exactly the same behavior in Ubuntu 18.04 based docker environments. I also tried different clangd versions, but seems it's not related to clangd

Coredump for one of the crashes

                Stack trace of thread 81922:
                #0  0x00007f1821402d22 raise (libc.so.6 + 0x3cd22)
                #1  0x00007f18213ec862 abort (libc.so.6 + 0x26862)
                #2  0x00007f1821444d28 __libc_message (libc.so.6 + 0x7ed28)
                #3  0x00007f182144c92a malloc_printerr (libc.so.6 + 0x8692a)
                #4  0x00007f182144e408 _int_free (libc.so.6 + 0x88408)
                #5  0x00007f18214519e8 __libc_free (libc.so.6 + 0x8b9e8)
                #6  0x00005646788f01ec vars_clear_ext (nvim + 0xf41ec)
                #7  0x00005646789349a9 free_unref_funccal (nvim + 0x1389a9)
                #8  0x00005646788f184f garbage_collect (nvim + 0xf584f)
                #9  0x0000564678a30ea8 os_inchar (nvim + 0x234ea8)
                #10 0x0000564678abc11f state_enter (nvim + 0x2c011f)
                #11 0x00005646789f563c normal_enter (nvim + 0x1f963c)
                #12 0x0000564678872141 main (nvim + 0x76141)
                #13 0x00007f18213edb25 __libc_start_main (libc.so.6 + 0x27b25)
                #14 0x00005646788733fe _start (nvim + 0x773fe)
                
                Stack trace of thread 81923:
                #0  0x00007f18214c492e epoll_wait (libc.so.6 + 0xfe92e)
                #1  0x00007f18217fc665 n/a (libuv.so.1 + 0x22665)
                #2  0x00007f18217e8897 uv_run (libuv.so.1 + 0xe897)
                #3  0x0000564678ae6397 n/a (nvim + 0x2ea397)

Thanks for the report, i have 3 questions.

Q1. Do you have the same crash with a nightly build of Neovim ?

Q2. Your minimal vimrc includes a bunch of plugins like NerdTree etc. Could you please remove them and tell me if you still observe the crash?
If so, please provide the new minimal vimrc.

Q3. What does you coc-settings.json look like as far as the excludes are concerned?

commented

@antoinemadec

Q1. Do you have the same crash with a nightly build of Neovim ?

Checking, post update later

Q2. Your minimal vimrc includes a bunch of plugins like NerdTree etc. Could you please remove them and tell me if you still observe the crash? If so, please provide the new minimal vimrc.

Yes, I can observe same w/

call plug#begin('~/.config/nvim/plugged')                                                                                                                                                                                             
Plug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'yarn install --frozen-lockfile'}                                                                                                                                                
Plug 'junegunn/fzf.vim'                                                                                                                                                                                                               
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }                                                                                                                                                                                   
Plug 'antoinemadec/coc-fzf', {'branch': 'release'}                                                                                                                                                                                                                                                                                                                                                                                             
call plug#end()   

Q3. What does you coc-settings.json look like as far as the excludes are concerned?

cat .config/nvim/coc-settings.json 
{
  "coc.preferences.extensionUpdateCheck": "weekly",
  "diagnostic.refreshOnInsertMode": true,
  "markdownlint.onChange": false
}

commented

@antoinemadec I see same error w/ nightly neovim

nvim --version 
NVIM v0.6.0-dev+566-g4174244d8
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az68-184

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/share/nvim"

Run :checkhealth for more info

I'm seeing the same crash. Should this be reported on neovim repo though?

Thanks for the workaround @r7vme, this crash is quite annoying.

@r7vme @weirdan , nvim should never crash, that's for sure.

However, I really don't trust some of the code that I added in 2d9deb2.
For instance, this:

symbol_excludes = eval(args.symbol_excludes)

If the crash comes from there, maybe a brutal try except could fix this ?
I will try to reproduce and work around this bug this weekend.

@r7vme @weirdan this was definitely a super weird issue with neovim.
Do you think one of you could create an issue on the neovim repo?

I'm sure they would ask for a minimal reproducer that I won't be able to come up with.

No pb, I will take care of it then.
Thanks anyway for the precise reporting and for finding the commit causing the regression!

commented

@antoinemadec appreciate that and thanks for the plugin