vim-hexokinase icon indicating copy to clipboard operation
vim-hexokinase copied to clipboard

Too many files open when running :vimgrep on large directory

Open Asheq opened this issue 5 years ago • 6 comments

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 avatar Nov 19 '19 20:11 Asheq

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 avatar Nov 20 '19 00:11 RRethy

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 :)

Asheq avatar Nov 20 '19 00:11 Asheq

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

RRethy avatar Nov 20 '19 00:11 RRethy

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"

ray-x avatar Apr 26 '21 10:04 ray-x

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?

RRethy avatar Apr 26 '21 15:04 RRethy

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.

ray-x avatar Apr 26 '21 22:04 ray-x