Skip to content
This repository was archived by the owner on Nov 22, 2022. It is now read-only.

Too many files open when running :vimgrep on large directory #45

Open
Asheq opened this issue Nov 19, 2019 · 6 comments
Open

Too many files open when running :vimgrep on large directory #45

Asheq opened this issue Nov 19, 2019 · 6 comments
Labels
enhancement New feature or request

Comments

@Asheq
Copy link

Asheq commented Nov 19, 2019

I ran into an issue while running :vimgrep inside a directory with a large number of files like this: :vimgrep /sometext/j **/*

After a couple or seconds of searching, the following error popped up:
image

Thanks for looking into it, and for creating this awesome plugin!

@Asheq Asheq changed the title Error when running :vimgrep Error when running :vimgrep Nov 19, 2019
@RRethy
Copy link
Owner

RRethy commented Nov 20, 2019

This can occur when too many files are opened at once because a hexokinase process is started for each file. :vimgrep seems to create unlisted buffers for each result so this is what's causing the too many files open. Two solutions would be to modify let g:Hexokinase_refreshEvents (to only check non-unlisted buffers) or to create a queue to cap the number of hexokinase processes started at once. In the meantime, a quickfix you might want to try is using let g:Hexokinase_ftDisabled or let g:Hexokinase_ftEnabled to restrict what type of files are parsed.

@RRethy RRethy changed the title Error when running :vimgrep Too many files open when running :vimgrep on large directory Nov 20, 2019
@RRethy RRethy added the bug Something isn't working label Nov 20, 2019
@Asheq
Copy link
Author

Asheq commented Nov 20, 2019

Thanks, it would make sense not to start a hexokinase process for unlisted buffers.

I'm using let g:Hexokinase_ftEnabled = ['css', 'html', 'scss'] for now and the error no longer appears for the projects I'm searching in :)

@RRethy
Copy link
Owner

RRethy commented Nov 20, 2019

Yea the problem with that is determining when it stops being unlisted, currently there are no autocmd-events for this. 🤔

@RRethy RRethy added Improvement and removed bug Something isn't working labels Nov 25, 2019
@RRethy RRethy added enhancement New feature or request and removed Improvement labels Jan 21, 2020
@ray-x
Copy link

ray-x commented Apr 26, 2021

I saw this issue today.
It is not a big project. There is only 1 lua file with 20 lines....

Error executing vim.schedule lua callback: Vim(let):E903: Process failed to start: too many open files: "/Users/rayx/.local/share/nvim/site/pack/packer/start/vim-hexokinase/hexokinase/hexokinase"

@RRethy
Copy link
Owner

RRethy commented Apr 26, 2021

Does it consistently error on this single file or was it a one-off? Also, did the output of :ls only have the single file?

@ray-x
Copy link

ray-x commented Apr 26, 2021

I only saw it twice so far and will try to capture more info when I saw it next time. It might be the LSP server parser trying to open buffers in the background.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants