Skip to content

signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x88866c #500

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
jeremyje opened this issue Apr 19, 2019 · 3 comments · Fixed by #502
Closed

signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x88866c #500

jeremyje opened this issue Apr 19, 2019 · 3 comments · Fixed by #502

Comments

@jeremyje
Copy link

Thank you for creating the issue!

Please include the following information:

  1. Version of golangci-lint: golangci-lint --version (or git commit if you don't use binary distribution)
  2. Config file: cat .golangci.yml
  3. Go environment: go version && go env
  4. Verbose output of running: golangci-lint run -v
build/toolchain/bin/golangci-lint --version
WARN No need to enable check "rangeValCopy": it's already enabled 
golangci-lint has version 1.16.0 built from 97ea1cb on 2019-03-31T19:48:46Z
go version && go env
go version go1.12 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jeremyje/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/jeremyje/workspace"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/golang"
GOTMPDIR=""
GOTOOLDIR="/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/workspace/relint/open-match/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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build570689449=/tmp/go-build -gno-record-gcc-switches"
# This file contains all available configuration options
# with their default values.

# https://github.com/golangci/golangci-lint#config-file

# options for analysis running
run:
  # default concurrency is a available CPU number
  concurrency: 4

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

  # exit code when at least one issue was found, default is 1
  issues-exit-code: 1

  # include test files or not, default is true
  tests: true

  # list of build tags, all linters use it. Default is empty list.
  build-tags:

  # which dirs to skip: they won't be analyzed;
  # can use regexp here: generated.*, regexp is applied on full path;
  # default value is empty list, but next dirs are always skipped independently
  # from this option's value:
  #   	vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
  skip-dirs:

  # which files to skip: they will be analyzed, but issues from them
  # won't be reported. Default value is empty list, but there is
  # no need to include all autogenerated files, we confidently recognize
  # autogenerated files. If it's not please let us know.
  skip-files:


# output configuration options
output:
  # colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number"
  format: colored-line-number

  # print lines of code with issue, default is true
  print-issued-lines: true

  # print linter name in the end of issue text, default is true
  print-linter-name: true


# all available settings of specific linters
linters-settings:
  errcheck:
    # report about not checking of errors in type assetions: `a := b.(MyStruct)`;
    # default is false: such cases aren't reported by default.
    check-type-assertions: true

    # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
    # default is false: such cases aren't reported by default.
    check-blank: true

  govet:
    # report about shadowed variables
    check-shadowing: true

    # settings per analyzer
    settings:
      printf: # analyzer name, run `go tool vet help` to see all analyzers
        funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer
          - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
          - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
          - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
          - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
  golint:
    # minimal confidence for issues, default is 0.8
    min-confidence: 0.8
  gofmt:
    # simplify code: gofmt with `-s` option, true by default
    simplify: true
  gocyclo:
    # minimal code complexity to report, 30 by default (but we recommend 10-20)
    min-complexity: 10
  maligned:
    # print struct with more effective memory layout or not, false by default
    suggest-new: true
  dupl:
    # tokens count to trigger issue, 150 by default
    threshold: 100
  goconst:
    # minimal length of string constant, 3 by default
    min-len: 3
    # minimal occurrences count to trigger, 3 by default
    min-occurrences: 3
  depguard:
    list-type: blacklist
    include-go-root: false
    packages:
      - github.com/davecgh/go-spew/spew
  misspell:
    # Correct spellings using locale preferences for US or UK.
    # Default is to use a neutral variety of English.
    # Setting locale to US will correct the British spelling of 'colour' to 'color'.
    locale: US
    ignore-words:
      - someword
  lll:
    # max line length, lines longer will be reported. Default is 120.
    # '\t' is counted as 1 character by default, and can be changed with the tab-width option
    line-length: 120
    # tab width in spaces. Default to 1.
    tab-width: 1
  unused:
    # treat code as a program (not a library) and report unused exported identifiers; default is false.
    # XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
    # if it's called for subdir of a project it can't find funcs usages. All text editor integrations
    # with golangci-lint call it on a directory with the changed file.
    check-exported: false
  unparam:
    # Inspect exported functions, default is false. Set to true if no external program/library imports your code.
    # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
    # if it's called for subdir of a project it can't find external interfaces. All text editor integrations
    # with golangci-lint call it on a directory with the changed file.
    check-exported: false
  nakedret:
    # make an issue if func has more lines of code than this setting and it has naked returns; default is 30
    max-func-lines: 30
  prealloc:
    # XXX: we don't recommend using this linter before doing performance profiling.
    # For most programs usage of prealloc will be a premature optimization.

    # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
    # True by default.
    simple: true
    range-loops: true # Report preallocation suggestions on range loops, true by default
    for-loops: false # Report preallocation suggestions on for loops, false by default
  gocritic:
    # Which checks should be enabled; can't be combined with 'disabled-checks';
    # See https://go-critic.github.io/overview#checks-overview
    # To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run`
    # By default list of stable checks is used.
    enabled-checks:
      - rangeValCopy

    # Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty
    disabled-checks:
      - regexpMust

    # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks.
    # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
    enabled-tags:
      - performance

    settings: # settings passed to gocritic
      captLocal: # must be valid enabled check name
        paramsOnly: true
      rangeValCopy:
        sizeThreshold: 32

linters:
  enable-all: true

issues:
  # List of regexps of issue texts to exclude, empty list by default.
  # But independently from this option we use default exclude patterns,
  # it can be disabled by `exclude-use-default: false`. To list all
  # excluded by default patterns execute `golangci-lint run --help`
  exclude:
    - abcdef

  # Excluding configuration per-path, per-linter, per-text and per-source
  exclude-rules:
    # Exclude some linters from running on tests files.
    - path: _test\.go
      linters:
        - gocyclo
        - errcheck
        - dupl
        - gosec

    # Exclude known linters from partially hard-vendored code,
    # which is impossible to exclude via "nolint" comments.
    - path: internal/hmac/
      text: "weak cryptographic primitive"
      linters:
        - gosec

    # Exclude some staticcheck messages
    - linters:
        - staticcheck
      text: "SA9003:"

    # Exclude lll issues for long lines with go:generate
    - linters:
        - lll
      source: "^//go:generate "

  # Independently from option `exclude` we use default exclude patterns,
  # it can be disabled by this option. To list all
  # excluded by default patterns execute `golangci-lint run --help`.
  # Default value for this option is true.
  exclude-use-default: false

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

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

  # Show only new issues: if there are unstaged changes or untracked files,
  # only those changes are analyzed, else only changes in HEAD~ are analyzed.
  # It's a super-useful option for integration of golangci-lint into existing
  # large codebase. It's not practical to fix all existing issues at the moment
  # of integration: much better don't allow issues in new code.
  # Default is false.
  new: false

  # Show only new issues created after git revision `REV`
  new-from-rev: REV
make golangcibuild/toolchain/bin/golangci-lint run -v --config=.golangci.yaml
INFO [config_reader] Used config file .golangci.yaml 
WARN No need to enable check "rangeValCopy": it's already enabled 
INFO [lintersdb] Active 31 linters: [deadcode depguard dupl errcheck gochecknoglobals gochecknoinits goconst gocritic gocyclo gofmt goimports golint gosec gosimple govet ineffassign interfacer lll maligned misspell nakedret prealloc scopelint staticcheck structcheck stylecheck typecheck unconvert unparam unused varcheck] 
INFO [lintersdb] Optimized sublinters [staticcheck gosimple unused stylecheck] into metalinter megacheck 
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x88866c]

goroutine 104 [running]:
go/types.(*Checker).handleBailout(0xc0008960f0, 0xc0008cdd08)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/check.go:240 +0x98
panic(0xcff060, 0x16cf680)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/runtime/panic.go:522 +0x1b5
go/types.(*StdSizes).Sizeof(0x0, 0xfca5a0, 0x16d1b00, 0xc00004fea0)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/sizes.go:154 +0x1bc
go/types.(*Config).sizeof(0xc000365ac0, 0xfca5a0, 0x16d1b00, 0xc000254501)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/sizes.go:245 +0x51
go/types.representableConst(0xfd6d20, 0xc000254598, 0xc0008960f0, 0x16d1b00, 0xc000365ba8, 0x1)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/expr.go:216 +0x207
go/types.(*Checker).representable(0xc0008960f0, 0xc000365b80, 0x16d1b00)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/expr.go:335 +0x69
go/types.(*Checker).convertUntyped(0xc0008960f0, 0xc000365b80, 0xfca5a0, 0x16d1b00)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/expr.go:517 +0x939
go/types.(*Checker).index(0xc0008960f0, 0xfd0c60, 0xc00088c740, 0xffffffffffffffff, 0xc00088cba0, 0xd0)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/expr.go:881 +0xc8
go/types.(*Checker).builtin(0xc0008960f0, 0xc000365b00, 0xc0003658c0, 0x8, 0x0)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/builtins.go:446 +0x328
go/types.(*Checker).call(0xc0008960f0, 0xc000365b00, 0xc0003658c0, 0x0)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/call.go:45 +0x65a
go/types.(*Checker).exprInternal(0xc0008960f0, 0xc000365b00, 0xfd0d60, 0xc0003658c0, 0x0, 0x0, 0x420b45)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/expr.go:1469 +0x1eb4
go/types.(*Checker).rawExpr(0xc0008960f0, 0xc000365b00, 0xfd0d60, 0xc0003658c0, 0x0, 0x0, 0xc0004d9200)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/expr.go:982 +0x81
go/types.(*Checker).multiExpr(0xc0008960f0, 0xc000365b00, 0xfd0d60, 0xc0003658c0)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/expr.go:1599 +0x58
go/types.(*Checker).initVars.func1(0xc000365b00, 0x0)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/assignments.go:209 +0x5a
go/types.unpack(0xc0004c5100, 0x1, 0x0, 0xdc75e0, 0x2a, 0xc0004c50f8)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/call.go:181 +0x61
go/types.(*Checker).initVars(0xc0008960f0, 0xc00014cd48, 0x1, 0x1, 0xc00037ae00, 0x1, 0x1, 0x0)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/assignments.go:209 +0xd8
go/types.(*Checker).shortVarDecl(0xc0008960f0, 0x6ff6, 0xc00037add0, 0x1, 0x1, 0xc00037ae00, 0x1, 0x1)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/assignments.go:322 +0x270
go/types.(*Checker).stmt(0xc0008960f0, 0x0, 0xfd0b60, 0xc000365900)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/stmt.go:398 +0x3846
go/types.(*Checker).stmtList(0xc0008960f0, 0x0, 0xc00083a580, 0x5, 0x8)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/stmt.go:120 +0xd1
go/types.(*Checker).funcBody(0xc0008960f0, 0xc0006f29c0, 0xc000254470, 0x3, 0xc00091c030, 0xc0003cbcb0, 0x0, 0x0)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/stmt.go:42 +0x1ec
go/types.(*Checker).funcDecl.func1()
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/decl.go:561 +0x67
go/types.(*Checker).processDelayed(0xc0008960f0, 0x0)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/resolver.go:615 +0x33
go/types.(*Checker).checkFiles(0xc0008960f0, 0xc00014ccc8, 0x1, 0x1, 0x0, 0x0)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/check.go:256 +0xbc
go/types.(*Checker).Files(...)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/go/types/check.go:245
github.com/golangci/golangci-lint/vendor/golang.org/x/tools/go/packages.(*loader).loadPackage(0xc0006a1360, 0xc000487cc0)
        /home/travis/gopath/src/github.com/golangci/golangci-lint/vendor/golang.org/x/tools/go/packages/packages.go:716 +0x53a
github.com/golangci/golangci-lint/vendor/golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
        /home/travis/gopath/src/github.com/golangci/golangci-lint/vendor/golang.org/x/tools/go/packages/packages.go:574 +0x17f
sync.(*Once).Do(0xc000487cd0, 0xc00033d780)
        /home/travis/.gimme/versions/go1.12.1.linux.amd64/src/sync/once.go:44 +0xb3
github.com/golangci/golangci-lint/vendor/golang.org/x/tools/go/packages.(*loader).loadRecursive(0xc0006a1360, 0xc000487cc0)
        /home/travis/gopath/src/github.com/golangci/golangci-lint/vendor/golang.org/x/tools/go/packages/packages.go:561 +0x67
github.com/golangci/golangci-lint/vendor/golang.org/x/tools/go/packages.(*loader).refine.func2(0xc0006a1360, 0xc00029bdc0, 0xc000487cc0)
        /home/travis/gopath/src/github.com/golangci/golangci-lint/vendor/golang.org/x/tools/go/packages/packages.go:542 +0x35
created by github.com/golangci/golangci-lint/vendor/golang.org/x/tools/go/packages.(*loader).refine
        /home/travis/gopath/src/github.com/golangci/golangci-lint/vendor/golang.org/x/tools/go/packages/packages.go:541 +0x765
Makefile:632: recipe for target 'golangci' failed
make: *** [golangci] Error 2
@nmittler
Copy link

I'm seeing this as well. It happens with both 1.15.0 and 1.16.0.

@jeremyje
Copy link
Author

I tried older versions seems that 1.12.2 fails more gracefully but 1.13+ does not.
Here's what I get in 1.12

INFO [loader] Go packages loading at mode load deps types and syntax took 1.172983354s 
ERRO Running error: context loading failed: failed to load program with go/packages: /usr/bin/gopackagesdriver: exit status 1: gopkgsdriver: EOF

@listx
Copy link

listx commented Apr 20, 2019

For me if I use 1.10.2 it avoids the panic:

GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/[email protected]

I got the idea to use 1.10.2 because it's the newest release before 0421bac which is the last commit to touch vendor/golang.org/x/tools/go/packages/packages.go, which is where the trace starts (I had the same trace).

Googling the keyword loadRecursive turned up this issue: golang/go#31163 which seems to be the same thing.

listx pushed a commit to listx/golangci-lint that referenced this issue Apr 20, 2019
This brings in the upstream fix
golang/tools@1aadbdf. (Upstream
issue is golang/go#31163).

To create this commit, I did:

  vgo get golang.org/x/tools
  make update_deps
  cd cmd/golangci-lint
  go install -ldflags "-X 'main.version=$(git describe --tags)' -X 'main.commit=$(git rev-parse --short HEAD)' -X 'main.date=$(date)'"

Fixes golangci#500
jirfag pushed a commit that referenced this issue Apr 20, 2019
This brings in the upstream fix
golang/tools@1aadbdf. (Upstream
issue is golang/go#31163).

To create this commit, I did:

  vgo get golang.org/x/tools
  make update_deps
  cd cmd/golangci-lint
  go install -ldflags "-X 'main.version=$(git describe --tags)' -X 'main.commit=$(git rev-parse --short HEAD)' -X 'main.date=$(date)'"

Fixes #500
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

Successfully merging a pull request may close this issue.

3 participants