golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.05k stars 17.68k forks source link

gopls SEGV fault on startup. #70271

Closed jkary closed 4 days ago

jkary commented 4 days ago

Go version

go version go1.23.2 linux/amd64

Output of go env in your module/workspace:

jkary@jkary-lnx01:~/src/go/containerlab$ go env
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/jkary/.cache/go-build'
GOENV='/home/jkary/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/jkary/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/jkary/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib/golang'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/lib/golang/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.2'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/jkary/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/jkary/src/go/containerlab/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-build3566001982=/tmp/go-build -gno-record-gcc-switches'

What did you do?

gopls just dies with a pointer error. I've tried reinstalling it with 'go install golang.org/x/tools/gopls@latest', but the issue persists.

What did you see happen?

I was attempting to use gopls with neovim. Neovim was complaining that it could figure out the version. Running the command gopls from the cli produced a stack trace.

jkary@jkary-lnx01:~/src/go/containerlab$ gopls
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x55dcfb56b29d]

goroutine 1 gp=0xc0000061c0 m=0 mp=0x55dcfc9e9760 [running]:
panic({0x55dcfc20b1c0?, 0x55dcfc969330?})
    /usr/lib/golang/src/runtime/panic.go:779 +0x158 fp=0xc00004fda0 sp=0xc00004fcf0 pc=0x55dcfb449fb8
runtime.panicmem(...)
    /usr/lib/golang/src/runtime/panic.go:261
runtime.sigpanic()
    /usr/lib/golang/src/runtime/signal_unix.go:881 +0x378 fp=0xc00004fe00 sp=0xc00004fda0 pc=0x55dcfb463538
golang.org/x/telemetry/internal/crashmonitor.Parent(0xc000390cd0)
    /usr/share/gocode/src/golang.org/x/telemetry/internal/crashmonitor/monitor.go:37 +0x3d fp=0xc00004fe20 sp=0xc00004fe00 pc=0x55dcfb56b29d
golang.org/x/telemetry.parent({0x82?, 0xaf?, {0x0?, 0x0?}})
    /usr/share/gocode/src/golang.org/x/telemetry/start.go:100 +0x237 fp=0xc00004fec8 sp=0xc00004fe20 pc=0x55dcfb78a5f7
golang.org/x/telemetry.Start({0x0?, 0x0?, {0x0?, 0x0?}})
    /usr/share/gocode/src/golang.org/x/telemetry/start.go:75 +0x85 fp=0xc00004ff08 sp=0xc00004fec8 pc=0x55dcfb78a345
main.main()
    /builddir/build/BUILD/golang-x-tools-0.22.0-build/tools-0.22.0/_build/src/golang.org/x/tools/gopls/main.go:29 +0x5a fp=0xc00004ff50 sp=0xc00004ff08 pc=0x55dcfbe2a59a
runtime.main()
    /usr/lib/golang/src/runtime/proc.go:271 +0x29d fp=0xc00004ffe0 sp=0xc00004ff50 pc=0x55dcfb44d5dd
runtime.goexit({})
    /usr/lib/golang/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc00004ffe8 sp=0xc00004ffe0 pc=0x55dcfb485581

goroutine 2 gp=0xc000006c40 m=nil [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
    /usr/lib/golang/src/runtime/proc.go:402 +0xce fp=0xc000068fa8 sp=0xc000068f88 pc=0x55dcfb44da2e
runtime.goparkunlock(...)
    /usr/lib/golang/src/runtime/proc.go:408
runtime.forcegchelper()
    /usr/lib/golang/src/runtime/proc.go:326 +0xb8 fp=0xc000068fe0 sp=0xc000068fa8 pc=0x55dcfb44d898
runtime.goexit({})
    /usr/lib/golang/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc000068fe8 sp=0xc000068fe0 pc=0x55dcfb485581
created by runtime.init.7 in goroutine 1
    /usr/lib/golang/src/runtime/proc.go:314 +0x1a

goroutine 3 gp=0xc000007180 m=nil [GC sweep wait]:
runtime.gopark(0x1?, 0x0?, 0x0?, 0x0?, 0x0?)
    /usr/lib/golang/src/runtime/proc.go:402 +0xce fp=0xc000069780 sp=0xc000069760 pc=0x55dcfb44da2e
runtime.goparkunlock(...)
    /usr/lib/golang/src/runtime/proc.go:408
runtime.bgsweep(0xc00003e070)
    /usr/lib/golang/src/runtime/mgcsweep.go:318 +0xdf fp=0xc0000697c8 sp=0xc000069780 pc=0x55dcfb43761f
runtime.gcenable.gowrap1()
    /usr/lib/golang/src/runtime/mgc.go:203 +0x25 fp=0xc0000697e0 sp=0xc0000697c8 pc=0x55dcfb42bf05
runtime.goexit({})
    /usr/lib/golang/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc0000697e8 sp=0xc0000697e0 pc=0x55dcfb485581
created by runtime.gcenable in goroutine 1
    /usr/lib/golang/src/runtime/mgc.go:203 +0x66

goroutine 4 gp=0xc000007340 m=nil [GC scavenge wait]:
runtime.gopark(0x10000?, 0x55dcfc11a328?, 0x0?, 0x0?, 0x0?)
    /usr/lib/golang/src/runtime/proc.go:402 +0xce fp=0xc000069f78 sp=0xc000069f58 pc=0x55dcfb44da2e
runtime.goparkunlock(...)
    /usr/lib/golang/src/runtime/proc.go:408
runtime.(*scavengerState).park(0x55dcfc9e7ae0)
    /usr/lib/golang/src/runtime/mgcscavenge.go:425 +0x49 fp=0xc000069fa8 sp=0xc000069f78 pc=0x55dcfb434fc9
runtime.bgscavenge(0xc00003e070)
    /usr/lib/golang/src/runtime/mgcscavenge.go:658 +0x59 fp=0xc000069fc8 sp=0xc000069fa8 pc=0x55dcfb435579
runtime.gcenable.gowrap2()
    /usr/lib/golang/src/runtime/mgc.go:204 +0x25 fp=0xc000069fe0 sp=0xc000069fc8 pc=0x55dcfb42bea5
runtime.goexit({})
    /usr/lib/golang/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc000069fe8 sp=0xc000069fe0 pc=0x55dcfb485581
created by runtime.gcenable in goroutine 1
    /usr/lib/golang/src/runtime/mgc.go:204 +0xa5

goroutine 18 gp=0xc000102700 m=nil [finalizer wait]:
runtime.gopark(0xc000068648?, 0x55dcfb41f5a5?, 0xa8?, 0x1?, 0xc0000061c0?)
    /usr/lib/golang/src/runtime/proc.go:402 +0xce fp=0xc000068620 sp=0xc000068600 pc=0x55dcfb44da2e
runtime.runfinq()
    /usr/lib/golang/src/runtime/mfinal.go:194 +0x107 fp=0xc0000687e0 sp=0xc000068620 pc=0x55dcfb42af47
runtime.goexit({})
    /usr/lib/golang/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc0000687e8 sp=0xc0000687e0 pc=0x55dcfb485581
created by runtime.createfing in goroutine 1
    /usr/lib/golang/src/runtime/mfinal.go:164 +0x3d

goroutine 59 gp=0xc0000b21c0 m=nil [GC worker (idle)]:
runtime.gopark(0xc0000b21c0?, 0xc00006bfb0?, 0x91?, 0x77?, 0xa00000000?)
    /usr/lib/golang/src/runtime/proc.go:402 +0xce fp=0xc00006bf50 sp=0xc00006bf30 pc=0x55dcfb44da2e
runtime.gcBgMarkWorker()
    /usr/lib/golang/src/runtime/mgc.go:1310 +0xe5 fp=0xc00006bfe0 sp=0xc00006bf50 pc=0x55dcfb42e005
runtime.goexit({})
    /usr/lib/golang/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc00006bfe8 sp=0xc00006bfe0 pc=0x55dcfb485581
created by runtime.gcBgMarkStartWorkers in goroutine 1
    /usr/lib/golang/src/runtime/mgc.go:1234 +0x1c

goroutine 62 gp=0xc0000b2700 m=nil [GC worker (idle)]:
runtime.gopark(0x14166e9c62f67?, 0xc0000b97b0?, 0x91?, 0x77?, 0xa00000000?)
    /usr/lib/golang/src/runtime/proc.go:402 +0xce fp=0xc0000b9750 sp=0xc0000b9730 pc=0x55dcfb44da2e
runtime.gcBgMarkWorker()
    /usr/lib/golang/src/runtime/mgc.go:1310 +0xe5 fp=0xc0000b97e0 sp=0xc0000b9750 pc=0x55dcfb42e005
runtime.goexit({})
    /usr/lib/golang/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc0000b97e8 sp=0xc0000b97e0 pc=0x55dcfb485581
created by runtime.gcBgMarkStartWorkers in goroutine 1
    /usr/lib/golang/src/runtime/mgc.go:1234 +0x1c

goroutine 60 gp=0xc000298380 m=nil [GC worker (idle)]:
runtime.gopark(0x14166e9c71264?, 0xc0002fc7b0?, 0x91?, 0x77?, 0xa00000000?)
    /usr/lib/golang/src/runtime/proc.go:402 +0xce fp=0xc0002fc750 sp=0xc0002fc730 pc=0x55dcfb44da2e
runtime.gcBgMarkWorker()
    /usr/lib/golang/src/runtime/mgc.go:1310 +0xe5 fp=0xc0002fc7e0 sp=0xc0002fc750 pc=0x55dcfb42e005
runtime.goexit({})
    /usr/lib/golang/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc0002fc7e8 sp=0xc0002fc7e0 pc=0x55dcfb485581
created by runtime.gcBgMarkStartWorkers in goroutine 1
    /usr/lib/golang/src/runtime/mgc.go:1234 +0x1c

goroutine 61 gp=0xc000298540 m=nil [GC worker (idle)]:
runtime.gopark(0x14166e9c4c5eb?, 0xc0002fcfb0?, 0x91?, 0x77?, 0xa00000000?)
    /usr/lib/golang/src/runtime/proc.go:402 +0xce fp=0xc0002fcf50 sp=0xc0002fcf30 pc=0x55dcfb44da2e
runtime.gcBgMarkWorker()
    /usr/lib/golang/src/runtime/mgc.go:1310 +0xe5 fp=0xc0002fcfe0 sp=0xc0002fcf50 pc=0x55dcfb42e005
runtime.goexit({})
    /usr/lib/golang/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc0002fcfe8 sp=0xc0002fcfe0 pc=0x55dcfb485581
created by runtime.gcBgMarkStartWorkers in goroutine 1
    /usr/lib/golang/src/runtime/mgc.go:1234 +0x1c
jkary@jkary-lnx01:~/src/go/containerlab$

What did you expect to see?

A non SEGV error.

gabyhelp commented 4 days ago

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

seankhliao commented 4 days ago

what's the output of go version -m path/to/gopls

jkary commented 4 days ago

I figured out my problem. I had 'golang-x-tools-gopls.x86_64: LSP server for Go' rpm package installed and it was masking the gopls executable for go 1.23. Once I removed this package all was good.