-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: limit the number of files open at the same time #21550
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
Comments
Hi, Thanks for opening this issue. Thank you for describing where the bug occurs, but can you please tell us how you trigger it. Output from go build / go test / go install would be best. |
Change https://golang.org/cl/57751 mentions this issue: |
if your Go packages with enough source files more than ulimit -n, it can trigger it. export GOROOT_BOOTSTRAP=/usr/lib/go-go1.9rc2 the output maybe like this: bootstrap/cmd/compile/internal/ssasrc/bootstrap/cmd/compile/internal/ssa/decompose.go:0:0: open src/bootstrap/cmd/compile/internal/ssa/decompose.go: too many open files this problem can be avioded if you modify max open files of system. but in my compiling environment, my code in cifs filesystem(linux mount filesystem from windows), in this environment , concurrent open the file will lead to error: input/output error, go build myproject golang.org/x/sys/unix../common/src/golang.org/x/sys/unix/sockcmsg_linux.go:0:0: open ../common/src/golang.org/x/sys/unix/sockcmsg_linux.go: input/output error so I hope I can control the max open files by environment variable GOMAXPROCS. sem := make(chan struct{}, runtime.GOMAXPROCS(0)) // Semaphore to guard against parsing too many source files simultaneously export GOMAXPROCS=1 |
Can you please explain why you need to build the Go distribution with such a small ulimit. |
small ulimit only for easy to trigger the error, but if Go packages with enough source files it will be a problem. And in special environment , concurrent open the file will lead to error: input/output error(EIO) , it lead to can not build code in such environment ,so I hope I can control the max open files by environment variable GOMAXPROCS. |
Closing in favor of #21621 since that one has a test case. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go1.9rc2
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?GOHOSTARCH="amd64"
GOHOSTOS="linux"
What did you do?
src/cmd/compile/internal/gc/noder.go : func parseFiles(filenames []string) uint
If the length of filenames is large, it will open too many files at
the same time, it will cause EMFILE error. modify code to limit max
goroutines.
The text was updated successfully, but these errors were encountered: