ms-jpq / coq_nvim

Fast as FUCK nvim completion. SQLite, concurrent scheduler, hundreds of hours of optimization.
GNU General Public License v3.0
3.58k stars 99 forks source link

[bug] occasional "too many open files" message on startup #529

Open vegerot opened 2 years ago

vegerot commented 2 years ago

For the last week or so, one in every ~10 times I open nvim I get this error. I'm not really sure where to start debugging it, but I see coq in the logs so I was hoping you could help figure out the next step in diagnosing the problem.

image

Reproduction steps (inconsistent):

  1. run nvim <path/to/file>
  2. Wait a few moments

Expected:

Actual:

Extra information:

  Plug 'ms-jpq/coq_nvim', {'branch': 'coq'} "main
  Plug 'ms-jpq/coq.artifacts', {'branch': 'artifacts'} " required extras
  Plug 'ms-jpq/coq.thirdparty', {'branch': '3p'} " - shell repl nvim lua api scientific calculator comment banner etc
vim.g.coq_settings = {
  ["clients.tabnine"] = {
    enabled = true,
    weight_adjust = -0.4,
  },
  auto_start = 'shut-up',
  -- conflicts with Tmux
  ["keymap.jump_to_mark"] = ''
}
❯ nvim --version
NVIM v0.9.0-dev-2736-g26c653718-dirty
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by m0c0j7y@m-c02fv6zrmd6r

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD-26c6537/share/nvim"

Run :checkhealth for more info
Shougo commented 2 years ago

What is your environment? It seems your system's resource limitation problem. You should check your open files limitation.

vegerot commented 2 years ago

Thanks. I think there is another bug, because macOS has a large limit for its open files.

image

And since this happens with only one file open, I'm pretty sure my limit is more than one! 😁

Any ideas how I can continue troubleshooting?

Shougo commented 2 years ago

Thanks. I think there is another bug, because macOS has a large limit for its open files.

Unfortunately I know macOS's resource limit is not larger than Linux. So it has the resource problem.

coq.nvim opens many processes to improve the performance, so you need to fix the problem.

$ launchctl limit displays your maxfiles limit. I think it is 256. It is too too low!

Please see this. https://vyspiansky.github.io/2021/06/22/too-many-open-files-error-on-macos/

vegerot commented 2 years ago

Thank you.

  1. ulimit says unlimited

  2. launchctl limit says maxfiles 256 unlimited

  3. I think it's important for software to meet users where they are. If this really is not a bug in coq.nvim or any of my plugins, and it happens when macOS users have no files open, then I would argue that coq.nvim should try to use less than 256 files on macOS.

  4. This just started recently. Do you know what caused the spike in simultaneous files open?

  5. I see no other reports for coq.nvim mentioning this error, making me think this is not coq.nvim acting normally

  6. Thanks!!! 😁 ☺️

cpmsmith commented 2 years ago

I've been seeing a similar error being thrown by gitsigns.nvim. I know that sounds like not Coq's problem, but recently it seemed fine, and then when I ran :COQnow, it started happening many times in a row. It sounds like lewis6991/gitsigns.nvim#168 could potentially be related? Could be a red herring, though.

towry commented 10 months ago

Seems i am encounter the same issue.

Notice following error log, i can't run :!echo "OK", but after kill the coq process, I am able to run it.

:!echo "OK"                                                                                              β”‚
                                                                                                         β”‚
shell failed to start: too many open files: /usr/local/bin/fish                                          β”‚
                                                                                                         β”‚
shell returned -1
E5108: Error executing lua /usr/local/share/nvim/runtime/lua/vim/_system.lua:241: EMFILE: too many open fβ”‚
iles                                                                                                     β”‚
stack traceback:                                                                                         β”‚
        [C]: in function 'error'                                                                         β”‚
        /usr/local/share/nvim/runtime/lua/vim/_system.lua:241: in function 'spawn'                       β”‚
        /usr/local/share/nvim/runtime/lua/vim/_system.lua:332: in function 'system'                      β”‚
        ...wry/.local/share/nvim/lazy/fzf-lua/lua/fzf-lua/utils.lua:876: in function 'io_system'         β”‚
        ...wry/.local/share/nvim/lazy/fzf-lua/lua/fzf-lua/utils.lua:937: in function 'fzf_version'       β”‚
        ...ry/.local/share/nvim/lazy/fzf-lua/lua/fzf-lua/config.lua:465: in function 'normalize_opts'    β”‚
        ...hare/nvim/lazy/fzf-lua/lua/fzf-lua/providers/buffers.lua:172: in function 'buffers_or_recent' β”‚
        [string ":lua"]:1: in main chunk
 [smart-splits.nvim]                                                                                      β”‚
Failed to get multiplexer pane ID                                                                        β”‚
[smart-splits.nvim]                                                                                      β”‚
Failed to get multiplexer pane ID

possible macos's issue, running 'pnpm store status' give me too many open files issue.