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

GolangCI crash on [runner/skip dirs] in Centos7 #260

Closed
chmouel opened this issue Oct 29, 2018 · 4 comments
Closed

GolangCI crash on [runner/skip dirs] in Centos7 #260

chmouel opened this issue Oct 29, 2018 · 4 comments

Comments

@chmouel
Copy link

chmouel commented Oct 29, 2018

I keep getting a crash under a fresh centos:7 docker container, I am not really sure when this is started but the CI on friday (26th) was working fine,

Version: 14f4dce
go version go1.9.4 linux/amd64

[test@ea05a8319767 golangci-lint]$ make
go install ./cmd/...
GL_TEST_RUN=1 golangci-lint run -v
INFO [config_reader] Config search paths: [./ /home/test/go/src/github.com/golangci/golangci-lint /home/test/go/src/github.com/golangci /home/test/go/src/github.com /home/test/go/src /home/test/go /home/test /home /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 21 linters: [deadcode depguard dupl errcheck goconst gocyclo gofmt goimports golint govet ineffassign interfacer lll megacheck misspell nakedret structcheck typecheck unconvert unparam varcheck]
INFO [loader] Go packages loading at mode load deps types and syntax took 5.367041548s
INFO [loader] SSA repr building took 923.596675ms
INFO [loader/astcache] Parsed AST of all pkg.GoFiles: [] for 412ns
INFO [runner/skip dirs] sorted abs args: [/home/test/go/src/github.com/golangci/golangci-lint]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa52ed5]

goroutine 3830 [running]:
github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint.(*fnVisitor).Visit(0xc4467bba40, 0x11bb740, 0xc435d98630, 0x1, 0xc4212b2b48)
        /home/test/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint/lint.go:837 +0x405
github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint.(*globalVisitor).Visit(0xc4467bba20, 0x11bb740, 0xc435d98630, 0x11b68c0, 0xc4467bba20)
        /home/test/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint/lint.go:820 +0xdc
go/ast.Walk(0x11b68c0, 0xc4467bba20, 0x11bb740, 0xc435d98630)
        /usr/lib/golang/src/go/ast/walk.go:52 +0x66
go/ast.walkDeclList(0x11b68c0, 0xc4467bba20, 0xc42ca459c0, 0x3, 0x4)
        /usr/lib/golang/src/go/ast/walk.go:38 +0x81
go/ast.Walk(0x11b68c0, 0xc4467bba20, 0x11bb6c0, 0xc4367f9300)
        /usr/lib/golang/src/go/ast/walk.go:353 +0x2672
github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint.NodeFns.func1(0xc44555f360, 0xc446846780, 0xc4466bd9f0)
        /home/test/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint/lint.go:787 +0x96
created by github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint.NodeFns
        /home/test/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint/lint.go:784 +0x112
make: *** [test] Error 2
[test@ea05a8319767 golangci-lint]$
@jirfag
Copy link
Member

jirfag commented Oct 29, 2018

hi, thank you for reporting!

  1. does it reproduce repeatedly?
  2. can you attach .golangci.yml?

As a workaround (and as a recommended way to use golangci-lint) please install it not by go get but with shell script into CI and use stable version 1.10.2

@chmouel
Copy link
Author

chmouel commented Oct 29, 2018

Yes I can, I am running this inside golangci-lint repository so this one then, but even when I remove this I still have that issue,

@chmouel
Copy link
Author

chmouel commented Oct 29, 2018

After a bit more investigation seems like it's megacheck that causes this error :

if I have :

linters:
  enable-all: true
  disable:
    - megacheck

it runs fine :

[test@ea05a8319767 golangci-lint]$ ./golangci-lint  run -v
INFO [config_reader] Config search paths: [./ /home/test/go/src/github.com/golangci/golangci-lint /home/test/go/src/github.com/golangci /home/test/go/src/github.com /home/test/go/src /home/test/go /home/test /home /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 23 linters: [deadcode depguard dupl errcheck goconst gocyclo gofmt goimports golint gosec govet ineffassign interfacer lll maligned misspell nakedret prealloc structcheck typecheck unconvert unparam varcheck]
INFO [loader] Go packages loading at mode load deps types and syntax took 4.675931579s
INFO [loader] SSA repr building took 402.375312ms
INFO [loader/astcache] Parsed AST of all pkg.GoFiles: [] for 330ns
INFO [runner/skip dirs] sorted abs args: [/home/test/go/src/github.com/golangci/golangci-lint]
INFO [runner] worker.1 took 1.947353619s with stages: golint: 1.015870234s, dupl: 592.840054ms, gofmt: 113.014649ms, interfacer: 112.240199ms, misspell: 76.502729ms, deadcode: 14.621394ms, errcheck: 8.263832ms, structcheck: 5.169964ms, maligned: 4.416249ms, lll: 2.982469ms, nakedret: 1.357099ms, typecheck: 6.181µs
INFO [runner] worker.2 took 1.952711176s with stages: unparam: 666.816016ms, depguard: 449.047084ms, gosec: 340.493001ms, goimports: 322.244111ms, ineffassign: 99.253378ms, govet: 23.311199ms, unconvert: 23.196114ms, varcheck: 20.48886ms, prealloc: 2.630506ms, gocyclo: 2.61254ms, goconst: 2.506389ms
INFO [runner] Workers idle times: #1: 16.180107ms
INFO [runner] processing took 3.389275ms with stages: cgo: 2.687696ms, path_prettifier: 656.81µs, skip_dirs: 5.838µs, autogenerated_exclude: 5.076µs, max_same_issues: 4.135µs, exclude: 3.96µs, skip_files: 3.749µs, uniq_by_line: 3.634µs, source_code: 3.44µs, nolint: 3.364µs, path_shortener: 3.321µs, max_per_file_from_linter: 3.169µs, max_from_linter: 2.975µs, diff: 2.108µs
INFO Memory: 52 samples, avg is 309.4MB, max is 973.8MB
INFO Execution took 7.198606444s

@jirfag
Copy link
Member

jirfag commented Nov 4, 2018

Yes, it's the megacheck, but I can't reproduce it even in docker centos:7.
I've inserted more logs, please fetch the latest development version from the master branch and run again with -v and attach the output.

jirfag added a commit that referenced this issue Nov 7, 2018
1. Fix crash if deps of analyzed packages weren't compiled.
2. Print deps typechecking errors
3. Fix all issues filtering because of empty go env GOCACHE for go < 1.10
jirfag added a commit that referenced this issue Nov 7, 2018
1. Fix crash if deps of analyzed packages weren't compiled.
2. Print deps typechecking errors
3. Fix all issues filtering because of empty go env GOCACHE for go < 1.10
jirfag added a commit that referenced this issue Nov 7, 2018
1. Fix crash if deps of analyzed packages weren't compiled.
2. Print deps typechecking errors
3. Fix all issues filtering because of empty go env GOCACHE for go < 1.10
jirfag added a commit that referenced this issue Nov 10, 2018
Fix crash because of parallel access to ssa.Program
jirfag added a commit that referenced this issue Nov 10, 2018
Fix crash because of parallel access to ssa.Program
jirfag added a commit that referenced this issue Nov 10, 2018
Fix crash because of parallel access to ssa.Program
jirfag added a commit that referenced this issue Nov 10, 2018
Fix crash because of parallel access to ssa.Program
@jirfag jirfag closed this as completed in 898ae4d Nov 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants