Skip to content
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

Reproducible memory leak in 1.51.1 #3609

Closed
4 tasks done
jamierajewski opened this issue Feb 17, 2023 · 2 comments
Closed
4 tasks done

Reproducible memory leak in 1.51.1 #3609

jamierajewski opened this issue Feb 17, 2023 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@jamierajewski
Copy link

Welcome

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc.).
  • Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.). (https://golangci-lint.run/usage/linters/)

Description of the problem

Following an upgrade to the latest Go version (1.20.1) through asdf after uninstalling all other Go versions on my machine, I uninstalled and reinstalled golangci-lint through brew and I now seem to be getting a consistent memory leak that climbs to ~48GB memory usage in ~1 minute of running.

Version of golangci-lint

$ golangci-lint --version
# Paste output here

golangci-lint has version 1.51.1 built from b87d2c1 on 2023-02-05T00:48:10Z

Configuration file

$ cat .golangci.yml
# paste output here
run:
  timeout: 5m
  tests: true
  skip-dirs-use-default: true
  issues-exit-code: 1
  skip-dirs:        # TODO: gradually rollout to other dirs/processes
    ....
  skip-files:     # TODO: enable linter on test files
    - .*_test.go
    ....

linters-settings:
  funlen:
    lines: 160
    statements: 60
  gocyclo:
    min-complexity: 15
  wsl:
    allow-cuddle-declarations: true

linters:
  disable-all: true
  enable:
    # default:
    - ineffassign
    - staticcheck
    - gosimple
    - unused
    - errcheck
    - govet
    - typecheck
    # extra:
    - funlen
    # - gochecknoinits    # TODO: Enable and fix complaints
    # - gocognit          # TODO: Enable and fix complaints
    - goconst
    - gocritic
    - gocyclo
    - gosec
    - unconvert
    # - wsl             # TODO: Enable and fix complaints
    - dogsled
    - gofmt
    - goimports
    - exportloopref
    - nakedret
    - dupl
    # - revive          # TODO: Enable and fix complaints

issues:
  exclude-rules:
    - path: _test\.go
      linters:
        - funlen
        - gocyclo
    - linters:
        - ineffassign
        - staticcheck
        - gosimple
        - funlen
        - gochecknoinits
        - gocognit
        - goconst
        - gocritic
        - gocyclo
        - gosec
        - unconvert
        - wsl
      source: '^//go:generate '
  fix: true

Go environment

$ go version && go env
# paste output here

go version go1.20.1 darwin/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/jamie.rajewski/Library/Caches/go-build"
GOENV="/Users/jamie.rajewski/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/jamie.rajewski/.asdf/installs/golang/1.20.1/packages/pkg/mod"
GONOPROXY="..."
GONOSUMDB="..."
GOOS="darwin"
GOPATH="/Users/jamie.rajewski/.asdf/installs/golang/1.20.1/packages"
GOPRIVATE="..."
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/jamie.rajewski/.asdf/installs/golang/1.20.1/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/jamie.rajewski/.asdf/installs/golang/1.20.1/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.20.1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/jamie.rajewski/PROJECT/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 x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_q/pz7mgvfx1cn9zp9x40x56ph80000gn/T/go-build956487027=/tmp/go-build -gno-record-gcc-switches -fno-common"

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
# paste output here

INFO [config_reader] Config search paths: [./ /Users/jamie.rajewski/PROJECT /Users/jamie.rajewski /Users /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 19 linters: [dogsled dupl errcheck exportloopref funlen goconst gocritic gocyclo gofmt goimports gosec gosimple govet ineffassign nakedret staticcheck typecheck unconvert unused]
INFO [loader] Go packages loading at mode 575 (name|exports_file|imports|files|types_sizes|compiled_files|deps) took 7.001689984s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 60.067445ms

# Had to kill the process here as this is where it stopped reporting output but the usage steadily climbed

Code example or link to a public repository

No public code available, it's a relatively large private project. Prior to upgrading, everything functioned correctly.

@jamierajewski jamierajewski added the bug Something isn't working label Feb 17, 2023
@boring-cyborg
Copy link

boring-cyborg bot commented Feb 17, 2023

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@ldez
Copy link
Member

ldez commented Feb 18, 2023

Hello,

I think brew is still using go1.19.

You can verify the go version used to build golangci-lint with the following command:

go version -m $(which golangci-lint)

ex:

$ go version -m ./golangci-lint       
./golangci-lint: go1.19.5
        path    github.com/golangci/golangci-lint/cmd/golangci-lint
        mod     github.com/golangci/golangci-lint       (devel) 
        dep     4d63.com/gochecknoglobals       v0.1.0  h1:zeZSRqj5yCg28tCkIV/z/lWbwvNm5qnKVS15PI8nhD0=
...

Duplicate of #3582, #3565, #3549, #3538, #3536, #3535, #3533, #3470

@ldez ldez closed this as completed Feb 18, 2023
@ldez ldez added duplicate This issue or pull request already exists and removed bug Something isn't working labels Feb 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants