Closed
Description
Description
nvim crashes reproducible for large directory trees if the options filesystem_watchers and git are enabled.
nvim: neovim/.deps/build/src/libuv/src/unix/core.c:270: uv__finish_close: Assertion `handle->flags & UV_HANDLE_CLOSING' failed.
I tried to debug this for a while and noticed that the git integration spawns git
around 490 times triggered by watcher events when I install node dependencies before it crashes. I couldn't find the exact reason for the crash.
Workaround: For my use case I excluded node_modules
from filesystem_watchers to avoid a huge pile of watcher events:
filesystem_watchers = {
[...]
ignore_dirs = {
".*/node_modules/.*",
}
}
gdb stackstrace from generated corefile:
[Current thread is 1 (Thread 0x7fe4f3de7b80 (LWP 421383))]
(gdb) bt
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)
at ./nptl/pthread_kill.c:44
#1 __pthread_kill_internal (signo=6, threadid=<optimized out>)
at ./nptl/pthread_kill.c:78
#2 __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
at ./nptl/pthread_kill.c:89
#3 0x00007fe4f3a3bc46 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4 0x00007fe4f3a227fc in __GI_abort () at ./stdlib/abort.c:79
#5 0x00007fe4f3a2271b in __assert_fail_base (
fmt=0x7fe4f3bbac30 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
assertion=0x564852238d88 "!(handle->flags & UV_HANDLE_CLOSED)",
file=0x564852238cc0 "/home/seb/devtmp/neovim/.deps/build/src/libuv/src/unix/core.c", line=271, function=<optimized out>) at ./assert/assert.c:92
#6 0x00007fe4f3a33596 in __GI___assert_fail (
assertion=0x564852238d88 "!(handle->flags & UV_HANDLE_CLOSED)",
file=0x564852238cc0 "/home/seb/devtmp/neovim/.deps/build/src/libuv/src/unix/core.c", line=271, function=0x564852238f00 <__PRETTY_FUNCTION__.9> "uv__finish_close")
at ./assert/assert.c:101
#7 0x00005648520f541d in uv.finish_close ()
#8 0x00005648520f5615 in uv.run_closing_handles ()
#9 0x00005648520f58ec in uv_run ()
#10 0x0000564851e5b8b0 in loop_uv_run (loop=0x5648522f3ac0 <main_loop>, ms=0,
once=true) at /home/seb/devtmp/neovim/src/nvim/event/loop.c:62
#11 0x0000564851e5b930 in loop_poll_events (loop=0x5648522f3ac0 <main_loop>, ms=0)
at /home/seb/devtmp/neovim/src/nvim/event/loop.c:84
#12 0x0000564851f94801 in do_os_system (argv=0x5648547c2f80, input=0x0, len=0,
output=0x7ffeb0c29bc0, nread=0x7ffeb0c29bb8, silent=true, forward_output=false)
at /home/seb/devtmp/neovim/src/nvim/os/shell.c:860
#13 0x0000564851f9460a in os_system (argv=0x5648547c2f80, input=0x0, len=0,
output=0x7ffeb0c29bc0, nread=0x7ffeb0c29bb8)
at /home/seb/devtmp/neovim/src/nvim/os/shell.c:826
#14 0x0000564851e0ef03 in get_system_output_as_rettv (argvars=0x7ffeb0c29f40,
rettv=0x7ffeb0c29ef0, retlist=false)
at /home/seb/devtmp/neovim/src/nvim/eval.c:5729
#15 0x0000564851e41217 in f_system (argvars=0x7ffeb0c29f40, rettv=0x7ffeb0c29ef0,
fptr=...) at /home/seb/devtmp/neovim/src/nvim/eval/funcs.c:8931
#16 0x0000564851e299df in call_internal_func (fname=0x564854589150 "system",
argcount=1, argvars=0x7ffeb0c29f40, rettv=0x7ffeb0c29ef0)
at /home/seb/devtmp/neovim/src/nvim/eval/funcs.c:207
#17 0x0000564851e50e41 in call_func (funcname=0x7fe4f3f065c8 "system", len=6,
rettv=0x7ffeb0c29ef0, argcount_in=1, argvars_in=0x7ffeb0c29f40,
funcexe=0x7ffeb0c29f00) at /home/seb/devtmp/neovim/src/nvim/eval/userfunc.c:1571
#18 0x0000564851eedfae in nlua_call (lstate=0x7fe4f3f03380)
at /home/seb/devtmp/neovim/src/nvim/lua/executor.c:1103
#19 0x00005648521717a6 in lj_BC_FUNCC ()
#20 0x000056485215d9f9 in lua_pcall (L=0x7fe4f3f03380, nargs=<optimized out>,
nresults=0, errfunc=<optimized out>) at lj_api.c:1116
#21 0x0000564851eeb2bd in nlua_pcall (lstate=0x7fe4f3f03380, nargs=0, nresults=0)
Neovim version
NVIM v0.8.2
Build type: Debug
LuaJIT 2.1.0-beta3
(Crashes for official build with `Build type: RelWithDebInfo` as well)
Operating system and version
Linux rz 5.19.0-29-generic #30-Ubuntu
nvim-tree version
Minimal config
vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvt-min/site]]
local package_root = "/tmp/nvt-min/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
require("packer").startup {
{
"wbthomason/packer.nvim",
"nvim-tree/nvim-tree.lua",
"nvim-tree/nvim-web-devicons",
-- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
},
config = {
package_root = package_root,
compile_path = install_path .. "/plugin/packer_compiled.lua",
display = { non_interactive = true },
},
}
end
if vim.fn.isdirectory(install_path) == 0 then
print "Installing nvim-tree and dependencies."
vim.fn.system { "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path }
end
load_plugins()
require("packer").sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua setup()]]
vim.opt.termguicolors = true
vim.opt.cursorline = true
-- MODIFY NVIM-TREE SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
_G.setup = function()
require("nvim-tree").setup {
git = {
enable = true,
ignore = false,
},
filesystem_watchers = {
enable = true,
debounce_delay = 50,
},
log = {
enable = true,
types = {
all = false,
config = false,
copy_paste = false,
dev = false,
diagnostics = false,
git = true,
profile = false,
watcher = true,
},
},
diagnostics = {
enable = true,
show_on_dirs = false,
},
update_focused_file = {
enable = true
},
renderer = {
group_empty = true,
},
filters = {
dotfiles = false,
},
}
end
Steps to reproduce
git clone git@github.com:facebook/create-react-app.git
cd create-react-app
nvim -nu /tmp/nvt-min.lua
:NvimTreeToggle
In another terminal:
cd create-react-app
rm -rf node_modules && yarn #(Repeat a few times)
Expected behavior
No crash
Actual behavior
nvim crashes with
nvim: neovim/.deps/build/src/libuv/src/unix/core.c:270: uv__finish_close: Assertion `handle->flags & UV_HANDLE_CLOSING' failed.