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

Excessive memory usage with go1.23rc2 using version 1.57.2 #4874

Closed
6 of 7 tasks
ncw opened this issue Jul 18, 2024 · 3 comments
Closed
6 of 7 tasks

Excessive memory usage with go1.23rc2 using version 1.57.2 #4874

ncw opened this issue Jul 18, 2024 · 3 comments
Labels
question Further information is requested

Comments

@ncw
Copy link

ncw commented Jul 18, 2024

Welcome

  • Yes, I'm using a binary release within 2 latest releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've read the typecheck section of the FAQ.
  • Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.).
  • I agree to follow this project's Code of Conduct

Description of the problem

When I run golangci-lint run ./... under go1.22 it uses a peak of about 3G of RAM after a golangci-lint cache clean

However if I use go1.23-rc2 it uses a peak of 17GB of RAM (well that is the point I run out of RAM in my laptop anyway).

This seems similar to #3565 which reported excessive memory usage after a go version update but that issue is fixed so may not be related.

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version 1.57.2 built with go1.22.1 from 77a8601a on 2024-03-28T19:01:11Z

Configuration

# golangci-lint configuration options

linters:
  enable:
    - errcheck
    - goimports
    - revive
    - ineffassign
    - govet
    - unconvert
    - staticcheck
    - gosimple
    - stylecheck
    - unused
    - misspell
    #- prealloc
    #- maligned
  disable-all: true

issues:
  # Enable some lints excluded by default
  exclude-use-default: false

  # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
  max-issues-per-linter: 0

  # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
  max-same-issues: 0

  exclude-rules:

    - linters:
      - staticcheck
      text: 'SA1019: "github.com/rclone/rclone/cmd/serve/httplib" is deprecated'

  # don't disable the revive messages about comments on exported functions
  include:
    - EXC0012
    - EXC0013
    - EXC0014
    - EXC0015

run:
  # timeout for analysis, e.g. 30s, 5m, default is 1m
  timeout: 10m

linters-settings:
  revive:
    # setting rules seems to disable all the rules, so re-enable them here
    rules:
      - name: blank-imports
        disabled: false
      - name: context-as-argument
        disabled: false
      - name: context-keys-type
        disabled: false
      - name: dot-imports
        disabled: false
      - name: empty-block
        disabled: true
      - name: error-naming
        disabled: false
      - name: error-return
        disabled: false
      - name: error-strings
        disabled: false
      - name: errorf
        disabled: false
      - name: exported
        disabled: false
      - name: increment-decrement
        disabled: true
      - name: indent-error-flow
        disabled: false
      - name: package-comments
        disabled: false
      - name: range
        disabled: false
      - name: receiver-naming
        disabled: false
      - name: redefines-builtin-id
        disabled: true
      - name: superfluous-else
        disabled: true
      - name: time-naming
        disabled: false
      - name: unexported-return
        disabled: false
      - name: unreachable-code
        disabled: true
      - name: unused-parameter
        disabled: true
      - name: var-declaration
        disabled: false
      - name: var-naming
        disabled: false
  stylecheck:
    # Only enable the checks performed by the staticcheck stand-alone tool,
    # as documented here: https://staticcheck.io/docs/configuration/options/#checks
    checks: ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022", "-ST1023"]

Go environment

$ go version && go env
go version go1.23rc2 linux/amd64
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/ncw/.cache/go-build'
GOENV='/home/ncw/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/ncw/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/ncw/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/go/go1.23'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/go/go1.23/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23rc2'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/ncw/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/ncw/go/src/github.com/rclone/rclone/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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2624476077=/tmp/go-build -gno-record-gcc-switches'

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /home/ncw/go/src/github.com/rclone/rclone /home/ncw/go/src/github.com/rclone /home/ncw/go/src/github.com /home/ncw/go/src /home/ncw/go /home/ncw /home /] 
INFO [config_reader] Used config file .golangci.yml 
INFO [lintersdb] Active 11 linters: [errcheck goimports gosimple govet ineffassign misspell revive staticcheck stylecheck unconvert unused] 
INFO [loader] Go packages loading at mode 575 (exports_file|files|types_sizes|compiled_files|deps|imports|name) took 887.753548ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 78.875194ms 
Killed

This died at around 18 GB memory usage. This works fine with go1.22 though.

A minimal reproducible example or link to a public repository

This is on the public repo https://github.com/rclone/rclone - the config file is checked in there too

Validation

  • Yes, I've included all information above (version, config, etc.).

Supporter

@ncw ncw added the bug Something isn't working label Jul 18, 2024
@ldez ldez added question Further information is requested and removed bug Something isn't working labels Jul 18, 2024
@ldez
Copy link
Member

ldez commented Jul 18, 2024

#4837

@ldez ldez closed this as completed Jul 18, 2024
@ncw
Copy link
Author

ncw commented Jul 18, 2024

go1.23 is due to be released in a week or two so now might be a good time to support it :-)

ncw added a commit to rclone/rclone that referenced this issue Jul 19, 2024
golangci-lint seems to have a bug which uses excess memory under go1.23

See: golangci/golangci-lint#4874
ncw added a commit to rclone/rclone that referenced this issue Jul 20, 2024
golangci-lint seems to have a bug which uses excess memory under go1.23

See: golangci/golangci-lint#4874
Fornax96 pushed a commit to Fornaxian/rclone that referenced this issue Jul 30, 2024
golangci-lint seems to have a bug which uses excess memory under go1.23

See: golangci/golangci-lint#4874
@akhilerm

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants