panic: pipe: too many open files
Describe the bug app crashes with panic: pipe: too many open files
To Reproduce is failing on a regular git repo
Expected behavior to work
Screenshots
panic: pipe: too many open files
goroutine 1676 [running]:
github.com/jesseduffield/lazygit/pkg/commands/loaders.(*BranchLoader).obtainBranches(0x140002a4f00, 0x0, 0x0, 0x0)
/home/runner/work/lazygit/lazygit/pkg/commands/loaders/branches.go:112 +0x56c
github.com/jesseduffield/lazygit/pkg/commands/loaders.(*BranchLoader).Load(0x140002a4f00, 0x14000856000, 0x1d1, 0x200, 0x1400024e1e0, 0x100af91e8, 0x1400012aea0, 0x0, 0x0)
/home/runner/work/lazygit/lazygit/pkg/commands/loaders/branches.go:52 +0x30
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).refreshBranches(0x1400024e1e0)
/home/runner/work/lazygit/lazygit/pkg/gui/branches_panel.go:63 +0x54
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).refreshCommits.func1()
/home/runner/work/lazygit/lazygit/pkg/gui/commits_panel.go:89 +0x40
github.com/jesseduffield/lazygit/pkg/utils.Safe.func1(0x1400012b4a0, 0x1400113d7b0)
/home/runner/work/lazygit/lazygit/pkg/utils/utils.go:95 +0x28
github.com/jesseduffield/lazygit/pkg/utils.SafeWithError(0x1400113d7b8, 0x0, 0x0)
/home/runner/work/lazygit/lazygit/pkg/utils/utils.go:106 +0x5c
github.com/jesseduffield/lazygit/pkg/utils.Safe(0x14000796258)
/home/runner/work/lazygit/lazygit/pkg/utils/utils.go:95 +0x40
created by github.com/jesseduffield/lazygit/pkg/gui.(*Gui).refreshCommits
/home/runner/work/lazygit/lazygit/pkg/gui/commits_panel.go:86 +0xa0
Desktop (please complete the following information):
- OS: macosx
- Lazygit Version 0,34
- The last commit id if you built project from sources (run :
git rev-parse HEAD)
Additional context worked on a small repo just fine, is there a limitation for big repos?
Is it a public repo so we can try to reproduce?
It is not public, is a private repo hosted in github with lots of branches and a good amount of files
I was able to capture the screen before crash

It's something, thanks!
Recently I've noticed that opening lazygit sometimes seems to bog down my system, even after I close it (I use it in a toggleterm in nvim)
Today when updating some nvim plugins I got this error when I started to notice my system being slow and just after opening & closing lazygit:
Vim:E903: Process failed to start: too many open files: "/usr/bin/git"
I'm working on a mono repo with 6 frontend apps, around 250k loc (not sure if that's small or large for lazygit...)
I don't know if it's related, I just wanted to mention it. I haven't seen lazygit crash yet, but I have had to restart my mac a few times recently after trying to use lazygit. The slowdown seems to be progressive and effects other apps, especially other git apps (I also use fork)
I have had to restart my mac
Okay, so it's on MacOS, could you give us more information, e.g. version of lazygit, version of git? Have you tried building and using the latest master?
(I use it in a toggleterm in nvim)
Does it happen if you use lazygit outside of nvim? Could you paste your config.yml?
I'm getting a similar stack trace, for a different error though, but they could all be related somehow :thinking: And I don't get this error for a fresh clone of the same repository.
my system: OS: Ubuntu 22.04.2 LTS x86_64 Kernel: 5.19.0-50-generic
Stack trace:
Error:
@Bhanukamax version of lazygit?
@Bhanukamax version of lazygit?
I'm using from git master branch, my copy was a bit old, now I pulled again and rebuild and tested, I still see the error and it's stuck on that screen and exits lazygit when pressed q. Don't see the stack trace anymore, might be because it was a dev build before or something (not sure, I'm not familiar much with go build flags, etc)
I'm getting a similar stack trace, for a different error though, but they could all be related somehow thinking And I don't get this error for a fresh clone of the same repository.
my system: OS: Ubuntu 22.04.2 LTS x86_64 Kernel: 5.19.0-50-generic
Stack trace:
Error:
I got my issue solved, it was because I had a branch with some extra space and some additional (probably non-utf-8, guessing from the error message) characters, which also caused some issues in some ci pipelines, lazy git error disappeared once I deleted that branch.
This is a user error, but I think it would be nice if it could also be handled on the application level.
I think the issue is that we do a refresh when we render an error, so we end up in an infinite loop, and that's what causes the too many open files error.
For what it's worth... for me, the issue ended up being a result of the anti virus installed on my company issued laptop. Specifically carbon black cloud, any time I did a git operation it would spike the se_agent process and CPU would go high, multiple git operations seemed to create a large backlog.

