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

vim.loop.walk() aborts every time (failed assertion) #11237

Closed
norcalli opened this issue Oct 16, 2019 · 3 comments
Closed

vim.loop.walk() aborts every time (failed assertion) #11237

norcalli opened this issue Oct 16, 2019 · 3 comments
Labels
bug-crash issue reporting a crash or segfault closed:duplicate issues that are closed as duplicates of other issues event-loop lua stdlib
Milestone

Comments

@norcalli
Copy link

NVIM v0.4.2
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim/src/build/config -I/build/neovim/src/neovim-0.4.2/src -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/src/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

Steps to reproduce using nvim -u NORC

❯ nvim -u NORC +'lua vim.loop.walk(print)'
nvim: /build/libluv/src/luv-1.30.1-0/src/loop.c:82: luv_walk_cb: Assertion `data && data->ref < 0x1000000' failed.
fish: “nvim -u NORC +'lua vim.loop.wal…” terminated by signal SIGABRT (Abort)

It appears that neovim is allocating handles outside of the range expected by luv. I think that luv would need to be altered to remove that assertion or another function (or perhaps just override vim.loop.walk) should be provided which behaves correctly.

I want to use uv.walk to be able to provide a job system which can look for existing timers, watchers, and others to display or clean up resources, so I would call it an essential function, as there is no other way to discover handles without hooking into every new_* method.

@norcalli norcalli added the bug issues reporting wrong behavior label Oct 16, 2019
@bfredl
Copy link
Member

bfredl commented Oct 16, 2019

luv.walk assumes that all handles are owned by luv, so that they can be cast to luv's own wrapper type. I think we need to wrap/replace this functionality safely from nvim.

@norcalli
Copy link
Author

Yeah that's what I figured. luv.walk shouldn't have been exposed in the first place if it aborts immediately, so if we're worried about API compatibility, we can replace it fine, but it may be misleading since it's the only function that wouldn't be directly equivalent to the luv ones.

I have a feeling that the vim.loop functionality will evolve greatly, though, before it's stabilized anyway.

@justinmk justinmk added this to the todo milestone Oct 19, 2019
@justinmk justinmk changed the title vim.loop.walk aborts every time from a failed assertion vim.loop.walk() aborts every time (failed assertion) Oct 19, 2019
@zeertzjq zeertzjq added bug-crash issue reporting a crash or segfault and removed bug issues reporting wrong behavior labels Feb 16, 2024
@zeertzjq
Copy link
Member

Closing in favor of #25043

@zeertzjq zeertzjq added the closed:duplicate issues that are closed as duplicates of other issues label Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-crash issue reporting a crash or segfault closed:duplicate issues that are closed as duplicates of other issues event-loop lua stdlib
Projects
None yet
Development

No branches or pull requests

4 participants