Closed
Description
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. (https://golangci-lint.run/usage/linters/)
Description of the problem
With v1.42.1 everything was fine, however since the update to v1.43.0 I often get some sort of "too many open file" errors when running it on a rather big (closed-source) project, either in combination with "failed to save|get data to low-level cache", linters not being able to run like gci in the example below, or errors like could not import <...> (<...>.go:1: too many open files) (typecheck)
.
The errors only occur when gocritic is enabled and stand-alone gocritic works just fine. The likelihood of such errors greatly increases when I run gociritic together with some other linters. My best guess is, that this is some resource leak connected with gocritic.
Version of golangci-lint
$ golangci-lint --version
golangci-lint has version 1.43.0 built from 861262b on 2021-11-02T20:54:42Z
Configuration file
run:
skip-dirs-use-default: true
modules-download-mode: vendor
timeout: 5m
output:
uniq-by-line: true
sort-results: true
linters-settings:
gocritic:
disabled-checks:
- sloppyReassign
- whyNoLint
enabled-tags:
- diagnostic
- style
- performance
linters:
enable:
- asciicheck
- bodyclose
- deadcode
- durationcheck
- errcheck
- errorlint
- exhaustive
- exportloopref
- forcetypeassert
- gci
- gocritic
- gofmt
- goimports
- gomoddirectives
- goprintffuncname
- gosec
- gosimple
- govet
Go environment
$ go version && go env
go version go1.17.2 darwin/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN="/usr/local/bin"
GOCACHE="/Users/julienschmidt/Library/Caches/go-build"
GOENV="/Users/julienschmidt/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/julienschmidt/go/pkg/mod"
GONOPROXY="<REDACTED>"
GONOSUMDB="<REDACTED>"
GOOS="darwin"
GOPATH="/Users/julienschmidt/go"
GOPRIVATE="<REDACTED>"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.17.2/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.17.2/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17.2"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="<REDACTED>"
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 x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/3v/sp9m614906g_7xcfhfhycyzm0000gn/T/go-build343025515=/tmp/go-build -gno-record-gcc-switches -fno-common"
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v --disable-all ./... 13:23
INFO [config_reader] Config search paths: [./ <REDACTED> /Users/julienschmidt/dev /Users/julienschmidt /Users /]
INFO [config_reader] Used config file .golangci.yaml
INFO [lintersdb] Active 18 linters: [asciicheck bodyclose deadcode durationcheck errcheck errorlint exhaustive exportloopref forcetypeassert gci gocritic gofmt goimports gomoddirectives goprintffuncname gosec gosimple govet]
INFO [loader] Go packages loading at mode 575 (files|types_sizes|compiled_files|exports_file|imports|name|deps) took 2.827652292s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 31.628005ms
WARN [linters context/goanalysis] Failed to persist facts to cache: failed to save data to low-level cache by key printf/facts for package <package1>: open /Users/julienschmidt/Library/Caches/golangci-lint/e2/e24a307ec1d4f19e6023639f91a2b1e33a9a2bbadcba08e4b8a7765245b19de7-d: too many open files
WARN [linters context/goanalysis] Failed to persist facts to cache: failed to save data to low-level cache by key ctrlflow/facts for package <package2>: open /Users/julienschmidt/Library/Caches/golangci-lint/e2/e24a307ec1d4f19e6023639f91a2b1e33a9a2bbadcba08e4b8a7765245b19de7-d: too many open files
WARN [linters context/goanalysis] Failed to persist facts to cache: failed to save data to low-level cache by key buildir/facts for package <package3>: open /Users/julienschmidt/Library/Caches/golangci-lint/e2/e24a307ec1d4f19e6023639f91a2b1e33a9a2bbadcba08e4b8a7765245b19de7-d: too many open files
WARN [linters context/goanalysis] Failed to persist facts to cache: failed to save data to low-level cache by key ctrlflow/facts for package <package4>: open /Users/julienschmidt/Library/Caches/golangci-lint/e2/e24a307ec1d4f19e6023639f91a2b1e33a9a2bbadcba08e4b8a7765245b19de7-d: too many open files
WARN [linters context/goanalysis] Failed to persist facts to cache: failed to save data to low-level cache by key printf/facts for package <package4>: open /Users/julienschmidt/Library/Caches/golangci-lint/e2/e24a307ec1d4f19e6023639f91a2b1e33a9a2bbadcba08e4b8a7765245b19de7-d: too many open files
WARN [linters context/goanalysis] Failed to persist facts to cache: failed to save data to low-level cache by key exhaustive/facts for package <package4>: open /Users/julienschmidt/Library/Caches/golangci-lint/e2/e24a307ec1d4f19e6023639f91a2b1e33a9a2bbadcba08e4b8a7765245b19de7-d: too many open files
INFO [linters context/goanalysis] analyzers took 8m27.322021697s with top 10 stages: gocritic: 6m18.642849702s, buildir: 58.238175393s, buildssa: 16.741482839s, goimports: 7.129339347s, gosec: 4.520575362s, gofmt: 4.031518176s, exhaustive: 3.735362383s, inspect: 2.677044192s, findcall: 2.519388948s, printf: 2.37948183s
WARN [runner] Can't run linter goanalysis_metalinter: gci: open <REDACTED>.go: too many open files
INFO [runner] processing took 5.016µs with stages: max_same_issues: 2.131µs, exclude: 410ns, skip_dirs: 368ns, nolint: 301ns, max_from_linter: 218ns, path_prettifier: 195ns, uniq_by_line: 147ns, cgo: 145ns, filename_unadjuster: 142ns, source_code: 135ns, skip_files: 127ns, identifier_marker: 124ns, autogenerated_exclude: 121ns, max_per_file_from_linter: 77ns, diff: 65ns, sort_results: 64ns, path_shortener: 64ns, severity-rules: 61ns, path_prefixer: 61ns, exclude-rules: 60ns
INFO [runner] linters took 31.656323073s with stages: goanalysis_metalinter: 31.656273088s
INFO File cache stats: 0 entries of total size 0B
INFO Memory: 314 samples, avg is 2325.8MB, max is 3566.2MB
INFO Execution took 34.525925327s
Code example or link to a public repository
none