Skip to content

"Failed to get persisted facts" errors with --allow-parallel-runners option #1769

Open
@autarch

Description

@autarch

Thank you for creating the issue!

  • [ X ] Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • [ X ] Yes, I've searched similar issues on GitHub and didn't find any.
  • [ X ] Yes, I've included all information below (version, config, etc).

Please include the following information:

Version of golangci-lint
$ golangci-lint --version
golangci-lint has version 1.37.1 built from b39dbcd6 on 2021-02-20T11:48:06Z
Config file
$ cat .golangci.yml
run:
  timeout: 5m
  skip-dirs:
    - service/.*/db$
    - service/.*/dbmodels$
    - service/.*/k8s$
    - service/.*/models$
    - service/.*/restapi$

linters:
  disable-all: true
  enable:
    - bodyclose
    - deadcode
    - errcheck
    - gocritic
    # We need to include both gofmt and goimports so we can get the simplify
    # suggestions from gofmt. See https://github.com/golang/go/issues/21476
    # for more info.
    - gofmt
    - goimports
    - golint
    - gosimple
    - govet
    - ineffassign
    - maligned
    - misspell
    - staticcheck
    - structcheck
    - typecheck
    - varcheck
    - whitespace
  fast: false

linters-settings:
  govet:
    check-shadowing: true
  errcheck:
    check-type-assertions: true

issues:
  max-issues-per-linter: 0
  max-same-issues: 0
  exclude-rules:
    - path: service/scheduler/web/handlers\.go
      linters:
        - ineffassign
Go environment
$ go version && go env
go version go1.15.8 linux/amd64
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/autarch/.cache/go-build"
GOENV="/home/autarch/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/autarch/go/pkg/mod"
GONOPROXY="github.com/ActiveState"
GONOSUMDB="github.com/ActiveState"
GOOS="linux"
GOPATH="/home/autarch/go"
GOPRIVATE="github.com/ActiveState"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/autarch/go/src/github.com/ActiveState/TheHomeRepot/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build102268167=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
# paste output here

Running that command won't really demonstrate anything, since the problem is with parallel runs.

The issue we've found is that running golangci-lint in parallel across many Go packages at once randomly raises cache errors.

Here's an example command that is being run:
golangci-lint run --config ./golangci-lint.yaml --new-from-rev HEAD~1 --allow-parallel-runners service/some-service/status/testcommon

And we get the following output:

[linters context/goanalysis] Failed to get persisted facts: failed to get data from low-level cache by key fact_deprecated/facts for package poly1305: read 0/175 bytes from /home/circleci/.cache/golangci-lint/6d/6d78660c561490491927308565fcbb57fcd62192de30916210f7d6d106df67d7-a with error EOF

Typically this will happen a few times (2-4) when running this across dozens of directories. The directories where this happens vary each time. Running with --allow-serial-runners seems to make this go away.

I'm guessing there's some sort of race condition with parallel runners and the cache files/directories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions