New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: too many open files in system #58788
Comments
What is the exact command that you run that prints that error message? |
Commands I ran that produce same error: go run . |
I ran go mod tidy earlier and it completely messed up everything and failed because it tried to search my entire filesystem. Not sure if causal relationship is there, but that context might help. I also tried uninstalling and reinstalling go and my terminal but that didn’t help. |
What does |
|
Compiling the But, that seems like something of a red herring — if the error is A good starting point for that investigation might be to run |
I have about 8007 open files in my system on fresh reboot and closing my applications. I set a soft limit for 10240, but there's a hard limit of unlimited. Even if I set the soft limit to unlimited, go still throws the same error.
I also tried changing the maxfile limit for MacOS following these instructions, which changes the default from 256 to 64000 when you open a fresh terminal (instead of having to manually set it per session), but that had no effect:
So I think I addressed the "too many open files in system" issue, but Go is still complaining. I suspect this is some MacOS-specific ARM64 weirdness and may just be unique to my machine. |
FWIW, based on https://superuser.com/questions/433746/is-there-a-fix-for-the-too-many-open-files-in-system-error-on-os-x-10-7-1 I checked a couple of the builders operated by the Go project and found:
Even on the Perhaps you have some kind of third-party service installed that is holding a lot of files open? |
Yeah, i’m going to do a clean install and see if I can reproduce. |
I was running out of file descriptors on Mac OS every few days a few months ago. It started around the time I installed Tailscale's Golink program, and it seemed to be related to that because, it seemed to stop when I stopped running it, and since I upgraded Golink a few weeks ago, the problem hasn't recurred. I'm still unsure what the root cause was though, maybe that's a coincidence. I've also had instability with my Time Machine backups. |
I erased all contents and settings on my Mac and re-installed go and was able to run it. There's still about ~6265 open files by default on Ventura 13.1, but And thanks to everyone for responding so quickly and jumping on this. Really impressed by the community and support. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Trying to run basic server:
I am not able to run or install the program.
What did you expect to see?
The server running.
What did you see instead?
/usr/local/go/src/vendor/golang.org/x/text/unicode/bidi/core.go:9:2: open /usr/local/go/src/log/example_test.go: too many open files in system
Why is
go
trying to open these files?The text was updated successfully, but these errors were encountered: