-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: mod tidy with ~1M subdirectories takes a very long time and then crashes computer #59860
Comments
pass in -v -x flags? |
It only happens when the system has been running for a few hours. After it restarts it shows
While the issue occurs, I can't start new applications, and I have one application that shows "xcrun too many open files". There was no output from go mod tidy, even with |
It has something to do with having massive numbers of subdirectories and no hard limit on file descriptors. If I run with |
Do each of those subdirectories contain at least one If you set |
Perhaps send |
I have a smaller reproduction:
I don't know if this causes issues on platforms other than MacOS. |
I can reproduce high CPU usage on Linux, but it doesn't cause a crash — and a module with that many directory entries seems well outside of the limits of what Go can reasonably be expected to support anyway. (I see ~3.9GiB of directory entries alone!)
So, my suggestion is to either escalate this to Apple as a macOS kernel bug, or find a way to structure your project so that either you have fewer directory entries overall or they are excluded from |
I think having ulimit -nH prevents the crash, so I think there's value in having a reasonable limit in place to prevent the worst case, even if the conditions for it to occur are fairly extreme. |
Moved to https://github.com/getlantern/replica-scripts. This is because the large number of working files for bucket-sql causes the go tool to have issues. golang/go#59860
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
This is a mistake. |
The crash seems to be platform-specific, and we have no reason to believe that the platform-specific crash is a Go bug. Again, I suggest that you escalate it to Apple as a potential macOS kernel bug. The solution to the performance issue seems straightforward: find a different way to structure the project. |
This probably seems a bit bizarre, and comes out of #56494 (comment) and #55955 (comment). I'm not sure how it's possible, I think it's a MacOS specific issue, possibly to do with
ulimit -n
, which I understand may have been changed around go1.19.Testing it is painful as my computer actually crashes as a result, and the project is private, but I'm happy to what I can to expose the issue or make a reproduction.
What version of Go are you using (
go version
)?go version devel go1.21-e007c515f3 Mon Apr 24 15:49:38 2023 +0000 darwin/arm64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/anacrolix/Library/Caches/go-build"
GOENV="/Users/anacrolix/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/anacrolix/go/pkg/mod"
GONOPROXY="github.com/anacrolix,github.com/some-company"
GONOSUMDB="github.com/anacrolix,github.com/some-company"
GOOS="darwin"
GOPATH="/Users/anacrolix/go"
GOPRIVATE="github.com/anacrolix,github.com/some-company"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/anacrolix/src/go.master"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/anacrolix/src/go.master/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="devel go1.21-e007c515f3 Mon Apr 24 15:49:38 2023 +0000"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/abs/path/to/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/m4/f67w9zfx1pl386_2yjs7xtkm0000gn/T/go-build2760210553=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
go mod tidy
What did you expect to see?
Nothing. Maybe a tidier go.mod and go.sum.
What did you see instead?
CPU is at 300-400% and memory climbs to ~400-500MiB over a few minutes then my computer switches off.
The text was updated successfully, but these errors were encountered: