Skip to content

Reproducible memory leak in 1.51.1 #3609

Closed
@jamierajewski

Description

@jamierajewski

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions