-
Notifications
You must be signed in to change notification settings - Fork 187
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
Segmentation fault sometimes occurs on latest Neovim #603
Comments
Thanks for reporting this. If possible, I'd like to find a way to reproduce it so we can verify that the eventual fix is correct. |
I've found one way to reproduce this, but it seems unlikely this is what you're running into, as the segfault happens at a different spot. If the async version of local uv = require('luv')
uv.fs_scandir('.', function() end)
-- no uv.run() call then the following will happen:
That is, the callback is executed during Lines 392 to 393 in 02d703b
A possible cause of the segfault you're experiencing (during Lines 452 to 454 in 02d703b
which is only triggered when using the async version of a function and the initial if(req->fs_type != UV_FS_SCANDIR) { check as is done everywhere else that this req cleanup code exists (since the EDIT: It's possible to hit this with an out-of-memory error when Libuv tries to copy the path string. Again, seems unlikely this is what's causing it but definitely worth protecting against. |
Artificially inducing an error in local uv = require('luv')
uv.fs_scandir('.', function() end)
uv.run()
I can't find another way to trigger this as of now, so I'll create a PR with these fixes and go from there. |
Thanks for your quick action! 😄 |
I built Neovim with the latest luv and the segfault did not occur. Thanks for the fix 😉 |
Looked into this a bit more because I still wasn't sure how normal usage was triggering the (what I considered to be) unlikely cases I fixed, and came away with a better understanding and more confidence that the fix was correct: When I said in a previous comment:
I was wrong. That same branch is triggered when the sync version of the function fails, too, so any error returned from the sync version of For example: local uv = require('luv')
local req, err = uv.fs_scandir('any-non-existent-path')
print(err)
uv.run() would give (before the fix):
|
I'm not quite sure under what conditions this happens, but it seems that sometimes
req->data
in the following code is NULL.luv/src/fs.c
Line 38 in 02d703b
As a result, Neovim falls down with the segmentation fault.
This occurs from commit 02d703b. Before that, it did not reproduce.
I would like to add a NULL check at the beginning of the following function, what do you think?
luv/src/lreq.c
Line 70 in 02d703b
ref: #600
The text was updated successfully, but these errors were encountered: