Skip to content

staticcheck uses too much memory and crashes #4932

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

Closed
6 of 7 tasks
tang-fh opened this issue Aug 21, 2024 · 3 comments
Closed
6 of 7 tasks

staticcheck uses too much memory and crashes #4932

tang-fh opened this issue Aug 21, 2024 · 3 comments
Labels
duplicate This issue or pull request already exists question Further information is requested

Comments

@tang-fh
Copy link

tang-fh commented Aug 21, 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

golangci-lint uses too much memory (and is killed) when running against the sources from https://github.com/prometheus/blackbox_exporter/

I have narrowed it down to the staticcheck linter.

Workarounds I have found:

Version of golangci-lint

$ ~/go/bin/golangci-lint --version
golangci-lint has version 1.56.2 built with go1.22.0 from 58a724a0 on 2024-02-15T18:01:51Z

Configuration

$ cat .golangci.yml 
# Run only staticcheck for now. Additional linters will be enabled one-by-one.
linters:
  disable-all: true
  enable:
    - misspell
    - staticcheck

Go environment

$ go version && go env
go version go1.23.0 linux/amd64
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/fhltang/.cache/go-build'
GOENV='/home/fhltang/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/fhltang/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/fhltang/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go1.23.0'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go1.23.0/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.0'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/fhltang/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/fhltang/blackbox_exporter/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-build2371056276=/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/fhltang/blackbox_exporter /home/fhltang /home /] 
INFO [config_reader] Used config file .golangci.yml 
INFO [lintersdb] Active 2 linters: [misspell staticcheck] 
INFO [loader] Go packages loading at mode 575 (files|imports|types_sizes|deps|exports_file|name|compiled_files) took 984.22745ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 4.722143ms 
INFO Memory: 415 samples, avg is 13735.1MB, max is 27340.7MB 
INFO Execution took 1m0.225270189s                
Killed

A minimal reproducible example or link to a public repository

$ git clone https://github.com/prometheus/blackbox_exporter.git
$ make
>> checking code style
>> checking license header
mkdir -p /home/fhltang/go/bin
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/v1.56.2/install.sh \
        | sed -e '/install -d/d' \
        | sh -s -- -b /home/fhltang/go/bin v1.56.2
golangci/golangci-lint info checking GitHub for tag 'v1.56.2'
golangci/golangci-lint info found version: 1.56.2 for v1.56.2/linux/amd64
golangci/golangci-lint info installed /home/fhltang/go/bin/golangci-lint
>> running golangci-lint
/home/fhltang/go/bin/golangci-lint run  ./...
make: *** [Makefile.common:172: common-lint] Killed

Validation

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

Supporter

@tang-fh tang-fh added the bug Something isn't working label Aug 21, 2024
Copy link

boring-cyborg bot commented Aug 21, 2024

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

@tang-fh
Copy link
Author

tang-fh commented Aug 21, 2024

Oops. It looks like blackbox_exporter is using an old version of golangci-lint https://github.com/prometheus/blackbox_exporter/blob/3dd5dfeaabc630ca0c2ec722a07f9755159ae0dd/Makefile.common#L64

@tang-fh
Copy link
Author

tang-fh commented Aug 21, 2024

It works using version 1.60.2

@tang-fh tang-fh closed this as not planned Won't fix, can't repro, duplicate, stale Aug 21, 2024
@ldez ldez added duplicate This issue or pull request already exists question Further information is requested and removed bug Something isn't working labels Aug 21, 2024
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 question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants