f-person / git-blame.nvim

Git Blame plugin for Neovim written in Lua
GNU General Public License v3.0
839 stars 41 forks source link

Scrolling quickly throws errors | too many open files: "/bin/zsh" #119

Closed alexteal closed 4 months ago

alexteal commented 5 months ago

Problem

An error gets thrown if you scroll up and down too fast. I've run into this a lot when handling large files and scrolling with the mouse too quickly. I'm going to attempt to find a fix for this, but I figured I'd make it known before I tried to do anything in case this is a known issue, or if someone else knows a fix.

config

The problem machine I've got is running OSX, with Neovim NVIM v0.9.1.

uname -a
Darwin interestingstranger.local 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct  9 20:14:54 PDT 2022; root:xnu-8792.41.9~2/RELEASE_X86_64 x86_64

I actually tried this on a headless ubuntu machine I've got over ssh, and seems like it's ok? I can scroll around on a 2000+ line file with no problems. It's Jetson Nano, so arm based: model name : ARMv8 Processor rev 1 (v8l)

uname -a 
Linux ubuntumachine 4.9.337-tegra #1 SMP PREEMPT Thu Jun 8 21:19:14 PDT 2023 aarch64 aarch64 aarch64 GNU/Linux

And, I think it's a problem on Mint linux machine I've got. Haven't tested it in a while, but when I have a chance I'll update this post with the info if necessary.

Error message

Error detected while processing CursorMoved Autocommands for "*":
Error executing lua callback: Vim:E903: Process failed to start: too many open files: "/bin/zsh"
stack traceback:
        [C]: in function 'jobstart'
        ...te/pack/packer/opt/git-blame.nvim/lua/gitblame/utils.lua:43: in function 'start_job'
        ...site/pack/packer/opt/git-blame.nvim/lua/gitblame/git.lua:11: in function 'check_is_ignored'
        ...ite/pack/packer/opt/git-blame.nvim/lua/gitblame/init.lua:323: in function 'get_blame_text'
        ...ite/pack/packer/opt/git-blame.nvim/lua/gitblame/init.lua:406: in function 'show_blame_info'
        ...ite/pack/packer/opt/git-blame.nvim/lua/gitblame/init.lua:426: in function <...ite/pack/packer/opt/git-blame.nvim/lua/gitblame/init.lua:411>

Checkhealth

Here's my checkhealth in case anyone knows where things are going wrong:

==============================================================================
diffview: require("diffview.health").check()

Checking plugin dependencies ~
- OK nvim-web-devicons installed.

Checking VCS tools ~
- The plugin requires at least one of the supported VCS tools to be valid.
- OK Git found.
- OK Git is up-to-date. (2.37.1)
- WARNING Configured `hg_cmd` is not executable: 'hg'

==============================================================================
mason: require("mason.health").check()

mason.nvim ~
- WARNING mason.nvim version v1.8.3
  - ADVICE:
    - The latest version of mason.nvim is: v1.9.0
- OK PATH: prepend
- OK Providers: 
  mason.providers.registry-api
  mason.providers.client
- OK neovim version >= 0.7.0

mason.nvim [Registries] ~
- OK Registry `github.com/mason-org/mason-registry version: 2023-11-28-humble-loaf` is installed.

mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send`
- OK wget: `GNU Wget 1.21.4 built on darwin22.4.0.`
- OK curl: `curl 7.87.0 (x86_64-apple-darwin13.4.0) libcurl/7.87.0 OpenSSL/1.1.1v zlib/1.2.13 libssh2/1.10.0 nghttp2/1.46.0`
- OK gzip: `Ok`
- OK tar: `bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8 `
- OK bash: `GNU bash, version 5.2.15(1)-release (x86_64-apple-darwin22.1.0)`
- OK sh: `Ok`

mason.nvim [Languages] ~
- WARNING luarocks: not available
  - ADVICE:
    - spawn: luarocks failed with exit code - and signal -. luarocks is not executable
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer failed with exit code - and signal -. composer is not executable
- OK Go: `go version go1.21.5 darwin/amd64`
- OK Ruby: `ruby 2.6.10p210 (2022-04-12 revision 67958) [x86_64-darwin21]`
- OK node: `v21.5.0`
- OK cargo: `cargo 1.74.0`
- OK RubyGem: `3.0.3.1`
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- OK npm: `10.2.4`
- OK python3_host_prog: `Python 3.10.6`
- OK java: `openjdk version "17.0.6" 2023-01-17`
- OK python: `Python 3.10.6`
- OK PHP: `PHP 8.3.1 (cli) (built: Dec 20 2023 12:44:38) (NTS)`
- OK javac: `javac 17.0.6`
- OK python3_host_prog pip: `pip 22.2.1 from /Users/alexteal/.config/nvim/venv/lib/python3.10/site-packages/pip (python 3.10)`
- OK pip: `pip 23.2.1 from /Users/alexteal/.pyenv/versions/3.10.6/lib/python3.10/site-packages/pip (python 3.10)`
- OK python venv: `Ok`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 0. Remaining: 5000. Limit: 5000. Reset: Thu Jan 11 14:42:06 2024.

==============================================================================
nvim: require("nvim.health").check()

Configuration ~
- OK no issues found

Runtime ~
- OK $VIMRUNTIME: /usr/local/Cellar/neovim/0.9.1/share/nvim/runtime

Performance ~
- OK Build type: Release

Remote Plugins ~
- OK Up to date

terminal ~
- key_backspace (kbs) terminfo entry: `key_backspace=^H`
- key_dc (kdch1) terminfo entry: `key_dc=\E[3~`
- $TERM_PROGRAM="tmux"
- $COLORTERM="truecolor"

tmux ~
- OK escape-time: 10
- OK focus-events: on
- $TERM: xterm-256color
- ERROR $TERM should be "screen-256color" or "tmux-256color" in tmux. Colors might look wrong.
  - ADVICE:
    - Set default-terminal in ~/.tmux.conf:
      set-option -g default-terminal "screen-256color"
    - https://github.com/neovim/neovim/wiki/Building-Neovim#optimized-builds
- WARNING Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly.
  - ADVICE:
    - Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux:
      set-option -sa terminal-features ',XXX:RGB'
    - For older tmux versions use this instead:
      set-option -ga terminal-overrides ',XXX:Tc'

==============================================================================
nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~
- OK `tree-sitter` found 0.20.8 (parser generator, only needed for :TSInstallFromGrammar)
- OK `node` found v21.5.0 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: Apple clang version 14.0.0 (clang-1400.0.29.202)
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
  machine = "x86_64",
  release = "22.1.0",
  sysname = "Darwin",
  version = "Darwin Kernel Version 22.1.0: Sun Oct  9 20:14:54 PDT 2022; root:xnu-8792.41.9~2/RELEASE_X86_64"
} ~

Parser/Features         H L F I J
  - c                   ✓ ✓ ✓ ✓ ✓
  - cmake               ✓ . ✓ ✓ .
  - html                ✓ ✓ ✓ ✓ ✓
  - javascript          ✓ ✓ ✓ ✓ ✓
  - latex               ✓ . ✓ . ✓
  - lua                 ✓ ✓ ✓ ✓ ✓
  - python              ✓ ✓ ✓ ✓ ✓
  - query               ✓ ✓ ✓ ✓ ✓
  - rust                ✓ ✓ ✓ ✓ ✓
  - tsx                 ✓ ✓ ✓ ✓ ✓
  - typescript          ✓ ✓ ✓ ✓ ✓
  - vim                 ✓ ✓ ✓ . ✓
  - vimdoc              ✓ . . . ✓

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang} ~

==============================================================================
provider: health#provider#check

Clipboard (optional) ~
- OK Clipboard tool found: pbcopy

Python 3 provider (optional) ~
- pyenv: Path: /usr/local/Cellar/pyenv/2.3.35/libexec/pyenv
- pyenv: Root: /Users/alexteal/.pyenv
- Using: g:python3_host_prog = "/Users/alexteal/.config/nvim/venv/bin/python3"
- Executable: /Users/alexteal/.config/nvim/venv/bin/python3
- Python version: 3.10.6
- pynvim version: 0.4.3 (outdated; from ~/.config/nvim/venv/lib/python3.10/site-packages/neovim)
- WARNING Latest pynvim is NOT installed: 0.5.0

Python virtualenv ~
- OK no $VIRTUAL_ENV

Ruby provider (optional) ~
- Ruby: ruby 2.6.10p210 (2022-04-12 revision 67958) [x86_64-darwin21]
- Host: /Users/alexteal/.rbenv/shims/neovim-ruby-host
- WARNING Gem "neovim" is out-of-date. Installed: 0.9.0, latest: 0.9.1
  - ADVICE:
    - Run in shell: gem update neovim

Node.js provider (optional) ~
- Node.js: v21.5.0
- Nvim node.js host: /Users/alexteal/.config/yarn/global//node_modules/neovim/bin/cli.js
- OK Latest "neovim" npm/yarn/pnpm package is installed: 4.10.1

Perl provider (optional) ~
- WARNING "Neovim::Ext" cpan module is not installed
  - ADVICE:
    - See :help |provider-perl| for more information.
    - You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim

==============================================================================
telescope: require("telescope.health").check()

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 13.0.0
- OK fd: found fd 8.7.0

===== Installed extensions ===== ~

Telescope Extension: `emoji` ~
- No healthcheck provided

Telescope Extension: `lazygit` ~
- No healthcheck provided

==============================================================================
vim.lsp: require("vim.lsp.health").check()

- LSP log level : WARN
- Log path: /Users/alexteal/.local/state/nvim/lsp.log
- Log size: 953 KB

vim.lsp: Active Clients ~
- lua_ls (id=1, root_dir=/Users/alexteal/.config/nvim/lua/)

==============================================================================
vim.treesitter: require("vim.treesitter.health").check()

- Nvim runtime ABI version: 14
- OK Parser: c          ABI: 14, path: /Users/alexteal/.local/share/nvim/site/pack/packer/start/nvim-treesitter/parser/c.so
- OK Parser: cmake      ABI: 14, path: /Users/alexteal/.local/share/nvim/site/pack/packer/start/nvim-treesitter/parser/cmake.so
- OK Parser: html       ABI: 14, path: /Users/alexteal/.local/share/nvim/site/pack/packer/start/nvim-treesitter/parser/html.so
- OK Parser: javascript ABI: 14, path: /Users/alexteal/.local/share/nvim/site/pack/packer/start/nvim-treesitter/parser/javascript.so
- OK Parser: latex      ABI: 14, path: /Users/alexteal/.local/share/nvim/site/pack/packer/start/nvim-treesitter/parser/latex.so
- OK Parser: lua        ABI: 14, path: /Users/alexteal/.local/share/nvim/site/pack/packer/start/nvim-treesitter/parser/lua.so
- OK Parser: python     ABI: 14, path: /Users/alexteal/.local/share/nvim/site/pack/packer/start/nvim-treesitter/parser/python.so
- OK Parser: rust       ABI: 14, path: /Users/alexteal/.local/share/nvim/site/pack/packer/start/nvim-treesitter/parser/rust.so
- OK Parser: tsx        ABI: 14, path: /Users/alexteal/.local/share/nvim/site/pack/packer/start/nvim-treesitter/parser/tsx.so
- OK Parser: typescript ABI: 14, path: /Users/alexteal/.local/share/nvim/site/pack/packer/start/nvim-treesitter/parser/typescript.so
- OK Parser: vim        ABI: 14, path: /Users/alexteal/.local/share/nvim/site/pack/packer/start/nvim-treesitter/parser/vim.so
- OK Parser: c          ABI: 14, path: /usr/local/Cellar/neovim/0.9.1/lib/nvim/parser/c.so
- OK Parser: lua        ABI: 14, path: /usr/local/Cellar/neovim/0.9.1/lib/nvim/parser/lua.so
- OK Parser: query      ABI: 14, path: /usr/local/Cellar/neovim/0.9.1/lib/nvim/parser/query.so
- OK Parser: vim        ABI: 14, path: /usr/local/Cellar/neovim/0.9.1/lib/nvim/parser/vim.so
- OK Parser: vimdoc     ABI: 14, path: /usr/local/Cellar/neovim/0.9.1/lib/nvim/parser/vimdoc.so
bossley9 commented 5 months ago

Thanks for the bug report and thorough investigation! I'll see if I can reproduce this on my end and find the issue. Is there a specific repo I can test with, or a file with a certain amount of lines?

f-person commented 5 months ago

Hi, @alexteal! Thanks for the detailed bug report! This seems similar to https://github.com/f-person/git-blame.nvim/issues/108 (which is also related to https://github.com/f-person/git-blame.nvim/issues/83). Does this also happen when there's no .git or on uncommitted files for you, or is this the case everywhere? In the former case, I'll eventually get to this, but there's a temporary fix in https://github.com/f-person/git-blame.nvim/issues/108#issuecomment-1767756548, in case it bothers you too much for now!

alexteal commented 5 months ago

Oh, didn't realize there were tickets with this already. Thanks for getting back to me on this btw!

Yeah, just tested it and it appears to happen in both directories with and without a .git.

I just made a large file with for i in {0..9999}; do echo -e "CONTENTCONTENTCONTENT\n" >> test.txt; done

Scrolled around some, and I got the same error:

Error detected while processing CursorMoved Autocommands for "*":
Error executing lua callback: Vim:E903: Process failed to start: too many open files: "/bin/zsh"
stack traceback:
        [C]: in function 'jobstart'
        ...te/pack/packer/opt/git-blame.nvim/lua/gitblame/utils.lua:43: in function 'start_job'
        ...site/pack/packer/opt/git-blame.nvim/lua/gitblame/git.lua:11: in function 'check_is_ignored'
        ...ite/pack/packer/opt/git-blame.nvim/lua/gitblame/init.lua:328: in function 'get_blame_text'
        ...ite/pack/packer/opt/git-blame.nvim/lua/gitblame/init.lua:411: in function 'show_blame_info'
        ...ite/pack/packer/opt/git-blame.nvim/lua/gitblame/init.lua:431: in function <...ite/pack/packer/opt/git-blame.nvim/lua/gitblame/init.lua:416>
f-person commented 5 months ago

I was just able to reproduce this with your example, thank you! I'll take a look at this when I have some spare time :)