Skip to content

cmd/compile: "too many open files in system" on macos Ventura #54833

Closed

Description

@jamesli2021

I'm running macOS Ventura and update to the latest beta build to test with Go 1.19. There could be a bug in Go reading files which might be affected when macOS Ventura is release to the public. Go 1.18.5 is working fine.

What version of Go are you using (go version)?

go version go1.19 darwin/arm64

Does this issue reproduce with the latest release?

Yes, 1.19

What operating system and processor architecture are you using (go env)?

macOS Ventura, M1 (arm)

What did you do?

Compiling a simple Go project and I get "too many open files in system".

What did you expect to see?

Able to compile as Go 1.18.5 which is working fine without error.

What did you see instead?

"... too many open files in system" appear in the terminal when ran "go build ." command.

Activity

  1. changed the title [-]affected/package: Go 1.19 on macos Ventura[/-] [+]cmd/compile: "too many open files in system" on macos Ventura[/+] on Sep 2, 2022
  2. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Sep 2, 2022
  3. added this to the Go1.20 milestone on Sep 2, 2022
  4. added
    WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.
    on Sep 2, 2022
  5. heschi commented on Sep 2, 2022

    @heschi
    Contributor

    cc @golang/compiler

    Please provide a full reproducer, log, and the output of go env.

  6. jamesli2021 commented on Sep 3, 2022

    @jamesli2021
    Author

    Here go env output:

    go env                   
    GO111MODULE=""
    GOARCH="arm64"
    GOBIN=""
    GOCACHE="/Users/s/Library/Caches/go-build"
    GOENV="/Users/s/Library/Application Support/go/env"
    GOEXE=""
    GOEXPERIMENT=""
    GOFLAGS=""
    GOHOSTARCH="arm64"
    GOHOSTOS="darwin"
    GOINSECURE=""
    GOMODCACHE="/Users/s/go/pkg/mod"
    GONOPROXY=""
    GONOSUMDB=""
    GOOS="darwin"
    GOPATH="/Users/s/go"
    GOPRIVATE=""
    GOPROXY="https://proxy.golang.org,direct"
    GOROOT="/usr/local/go"
    GOSUMDB="sum.golang.org"
    GOTMPDIR=""
    GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
    GOVCS=""
    GOVERSION="go1.19"
    GCCGO="gccgo"
    AR="ar"
    CC="clang"
    CXX="clang++"
    CGO_ENABLED="1"
    GOMOD="/Users/s/Documents/aaa/go.mod"
    GOWORK=""
    CGO_CFLAGS="-g -O2"
    CGO_CPPFLAGS=""
    CGO_CXXFLAGS="-g -O2"
    CGO_FFLAGS="-g -O2"
    CGO_LDFLAGS="-g -O2"
    PKG_CONFIG="pkg-config"
    GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/q6/vgzzlsv56j5_jk6_ysj8ld0c0000gn/T/go-build4248313789=/tmp/go-build -gno-record-gcc-switches -fno-common"
    
  7. added
    WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.
    and removed
    WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.
    on Sep 9, 2022
  8. gopherbot commented on Oct 9, 2022

    @gopherbot
    Contributor

    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.)

  9. yyuyitian commented on Dec 10, 2022

    @yyuyitian

    i meet the same problem with go version 1.19.2

  10. sunznx commented on Dec 15, 2022

    @sunznx

    I solved by remove $GOCACHE dir

    go env get GOCACHE

  11. tstarbow-sfdc commented on Feb 22, 2023

    @tstarbow-sfdc

    go clean -cache

    Solved a similar issue for me.

  12. alecthomas commented on Jul 17, 2023

    @alecthomas

    Same issue here, and same fix:

    🐚 ~/dev/ftl $ find /Users/alec/Library/Caches/go-build
    🐚 ~/dev/ftl $ go build ./cmd/ftl-controller
    ../../Library/Caches/hermit/pkg/go-1.20.5/src/crypto/crypto.go:9:2: open /Users/alec/Library/Caches/hermit/pkg/go-1.20.5/src/hash: too many open files in system
    🐚 ~/dev/ftl $ go env get GOCACHE
    /Users/alec/Library/Caches/go-build
    🐚 ~/dev/ftl $ rm -rf ~/Library/Caches/go-build aat/ingress-directive
    🐚 ~/dev/ftl $ go build ./cmd/ftl-controller
    🐚 ~/dev/ftl $
    

    This sounds like a classic case of not closing a file somewhere?

  13. ianlancetaylor commented on Jul 18, 2023

    @ianlancetaylor
    Contributor

    @alecthomas Can you provide the go env output on your system? Thanks.

  14. alecthomas commented on Jul 18, 2023

    @alecthomas

    For sure. I'm a bit annoyed that I didn't take a backup of the GOCACHE directory.

    GO111MODULE=""
    GOARCH="arm64"
    GOBIN="/Users/alec/dev/ftl/.hermit/go/bin"
    GOCACHE="/Users/alec/Library/Caches/go-build"
    GOENV="/Users/alec/Library/Application Support/go/env"
    GOEXE=""
    GOEXPERIMENT=""
    GOFLAGS=""
    GOHOSTARCH="arm64"
    GOHOSTOS="darwin"
    GOINSECURE=""
    GOMODCACHE="/Users/alec/go/pkg/mod"
    GONOPROXY="*.sqcorp.co,github.com/squareup"
    GONOSUMDB="*.sqcorp.co,github.com/squareup"
    GOOS="darwin"
    GOPATH="/Users/alec/go"
    GOPRIVATE="*.sqcorp.co,github.com/squareup"
    GOPROXY="https://proxy.golang.org,direct"
    GOROOT="/Users/alec/Library/Caches/hermit/pkg/go-1.20.5"
    GOSUMDB="sum.golang.org"
    GOTMPDIR=""
    GOTOOLDIR="/Users/alec/Library/Caches/hermit/pkg/go-1.20.5/pkg/tool/darwin_arm64"
    GOVCS=""
    GOVERSION="go1.20.5"
    GCCGO="gccgo"
    AR="ar"
    CC="clang"
    CXX="clang++"
    CGO_ENABLED="1"
    GOMOD="/Users/alec/dev/ftl/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 -fdebug-prefix-map=/var/folders/h2/_9k30gds1dbdjsv1m3yw834w0000gn/T/go-build2041056486=/tmp/go-build -gno-record-gcc-switches -fno-common"
    
  15. alecthomas commented on Jul 18, 2023

    @alecthomas

    An extra bit of potentially useful information is that it would always report this error on the exact same directory (open /Users/alec/Library/Caches/hermit/pkg/go-1.20.5/src/hash). I also did a bunch of lsofing, and checked the ulimits on my machine and couldn't see anything obviously misconfigured.

  16. ianlancetaylor commented on Jul 19, 2023

    @ianlancetaylor
    Contributor

    I note that the reports that provide the information are all darwin/arm64. Is anybody seeing this problem on a different system?

  17. ncdc commented on Jul 24, 2023

    @ncdc

    I just ran into it on darwin/amd64. go clean -cache fixed it for me.

  18. xlanor commented on Jul 25, 2023

    @xlanor

    ran into this on darwin/amd64 too, when my autogeneration failed midway. Likewise, go clean -cache fixed it.

    My ulimit was originally at 256 but the problem persisted even after raising it to 10,000.

    Am also on macos ventura.

  19. m0jeda commented on Apr 26, 2024

    @m0jeda

    Also ran into this on darwin/amd64. I saw the error after I updated to Sonoma 14.4.1.
    I tried updating the ulimit, but the problem persisted. It was fixed after running go clean -cache

  20. ZippoLee12138 commented on Aug 5, 2024

    @ZippoLee12138

    Also ran into this on darwin/amd64. I saw the error after I updated to Sonoma 14.4.1. I tried updating the ulimit, but the problem persisted. It was fixed after running go clean -cache

    It's work for me

  21. jacevys commented on May 22, 2025

    @jacevys

    I just ran into it on darwin/amd64. go clean -cache fixed it for me.

    man, this worked for me, thanks!!!

  22. jacevys commented on May 22, 2025

    @jacevys

    I solved by remove $GOCACHE dir

    go env get GOCACHE

    man, this worked for me, thanks!!!

  23. locked and limited conversation to collaborators on May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions