coq_nvim icon indicating copy to clipboard operation
coq_nvim copied to clipboard

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

Open vegerot opened this issue 3 years ago β€’ 6 comments

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:

  • neovim and coq work fine

Actual:

  • Get this error: (also, note the text inserted in the scrot at the top of this issue)
Error executing vim.schedule lua callback: Vim:Failed to start server: too many open files
stack traceback:
        [C]: in function 'serverstart'
        ...s/m0c0j7y/.local/share/nvim/plugged/coq_nvim/lua/coq.lua:120: in function <...s/m0c0j7y/.local/share/nvim/plugged/coq_nvim/lua/coq.lua:116>
        ...s/m0c0j7y/.local/share/nvim/plugged/coq_nvim/lua/coq.lua:135: in function ''
        vim/_editor.lua: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

Extra information:

  • How frequently does this happen? Maybe one in ten times I open neovim. I might be wrong, but I feel like it is more likely to happen when I haven't opened nvim for a while
  • What file types does this happen with? Every kind I've worked with (Go, C++, TypeScript, JSON, YAML)
  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

vegerot avatar Oct 13 '22 23:10 vegerot

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

Shougo avatar Oct 14 '22 01:10 Shougo

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?

vegerot avatar Oct 14 '22 01:10 vegerot

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/

Shougo avatar Oct 14 '22 07:10 Shougo

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!!! 😁 ☺️

vegerot avatar Oct 14 '22 17:10 vegerot

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.

cpmsmith avatar Nov 01 '22 21:11 cpmsmith

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.

towry avatar Jan 18 '24 03:01 towry