akinsho / git-conflict.nvim

A plugin to visualise and resolve merge conflicts in neovim
1k stars 35 forks source link

Process failed to start: too many open files #29

Closed balazser closed 1 year ago

balazser commented 2 years ago

Hi @akinsho,, Since I updated nvim packages the last time, I started to receive this error message :point_down: . Is this possible [git-conflict.nvim](https://github.com/akinsho/git-conflict.nvim) kick off too many watchers?

Error executing vim.schedule lua callback: Vim:E903: Process failed to start: too many open files: "/bin/sh"
stack traceback:
        [C]: in function 'jobstart'
        ...acker/start/git-conflict.nvim/lua/git-conflict/utils.lua:10: in function 'job'
        ...pack/packer/start/git-conflict.nvim/lua/git-conflict.lua:138: in function 'get_git_root'
        ...pack/packer/start/git-conflict.nvim/lua/git-conflict.lua:149: in function 'get_conflicted_files'
        ...pack/packer/start/git-conflict.nvim/lua/git-conflict.lua:380: in function 'fetch_conflicts'
        ...pack/packer/start/git-conflict.nvim/lua/git-conflict.lua:409: in function 'func'
        ...acker/start/git-conflict.nvim/lua/git-conflict/utils.lua:25: in function 'on_throttled_change'
        ...pack/packer/start/git-conflict.nvim/lua/git-conflict.lua:433: in function 'cb'
        vim/_editor.lua:256: in function <vim/_editor.lua:256>
Press ENTER or type command to continue

after hitting enter it continues:

stack traceback:
^I[C]: in function 'jobstart'
^I...acker/start/git-conflict.nvim/lua/git-conflict/utils.lua:10: in function 'job'
^I...pack/packer/start/git-conflict.nvim/lua/git-conflict.lua:152: in function 'callback'
^I...pack/packer/start/git-conflict.nvim/lua/git-conflict.lua:138: in function 'callback'
^I...acker/start/git-conflict.nvim/lua/git-conflict/utils.lua:12: in function <...acker/start/git-conflict.nvim/lua/git-conflict/utils.lua:12> function: builtin#18 Vim:E903: Process failed to start: too many open files: "/bin/sh"
akinsho commented 2 years ago

@balazser are you on macOS, if so there is a known issue with that platform which is that it limits the number of jobs that can be run at the same time which leads to this error which isn't specific to this plugin.

Each directory only has one watcher, so unless you have buffers from dozens of directories open, there shouldn't be more than one watcher at a time. Also, watchers are only assigned when loading neovim or changing directory

balazser commented 2 years ago

Hi @akinsho, hmm. I'm on Debian GNU/Linux 11. cat /proc/sys/fs/inotify/max_user_watches shows the default 8192. I remove the fixed commit = "548fad418e77ab512ba0333bede22eb5fc9b0d18" and increase the number of watchers. I will reopen the issue if I still meet the issue. Thank you :pray:

balazser commented 2 years ago

image

Unfortunately, It still occurs. I forgot to mention this issue happens when I use the :Gitsigns stage_hunk mapping from gitsigns.nvim plugin. Is this possible somehow that the two plugins start a reaction loop? If I fix git-conflict.nvim version to commit = "548fad418e77ab512ba0333bede22eb5fc9b0d18" then it works well.

My inotify config is the following now:

sudo sysctl fs.inotify.max_user_watches
fs.inotify.max_user_watches = 660000

curl -s https://raw.githubusercontent.com/fatso83/dotfiles/master/utils/scripts/inotify-consumers | bash shows me that I have

116  WATCHES TOTAL COUNT

when the exception happens :confused:

mdgoldberg commented 2 years ago

Hey all, I'm getting this as well. Let me know if I can provide any additional information. I am on macOS. Is there a workaround? Or should I just not use the plugin on macOS?

akinsho commented 2 years ago

Can everyone encountering this issue please use the last stable version that was tagged, which I believe is v1.0.0. As I mention in the README, I'm still trying to land on the best approach and the directory watching solution needs some tweaks.

akinsho commented 2 years ago

I've refactored the behaviour of the watchers on the main branch, can someone in this thread or ideally multiple people test it out and let me know if they still get this error? cc @balazser being the OP

alycklama commented 3 months ago

I just ran into this issue and I'm on commit 45cde6f and Sonoma 14.4.1.

These are the steps on my side to reproduce the error:

-- to clear register a
qaq
-- to append all results to register a
g/TODO:/y A
-- to put all findings in the quicklist
vimgrep //g **/*

After 20 results it will throw the error:

Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: Vim:E903: Process failed to start: too many open files: "/usr/bin/git"
stack traceback:
        [C]: in function 'jobstart'
        ...e/nvim/lazy/git-conflict.nvim/lua/git-conflict/utils.lua:25: in function 'job'
        ...l/share/nvim/lazy/git-conflict.nvim/lua/git-conflict.lua:173: in function 'get_git_root'
        ...l/share/nvim/lazy/git-conflict.nvim/lua/git-conflict.lua:411: in function 'fetch_conflicts'
        ...l/share/nvim/lazy/git-conflict.nvim/lua/git-conflict.lua:625: in function <...l/share/nvim/lazy/git-conflict.nvim/lua/git-conflict.lua:621>