golang / go

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

x/tools/gopls: nil deref in evaluatePackageHandle (telemetry) #69236

Open adonovan opened 1 month ago

adonovan commented 1 month ago

This stack kRRIIg was reported by telemetry:

We don't have a program counter, so we can't tell if it is succ or succ.ph that is nil. (We know n.ph.depKeys is non-nil.)

    reachable := b.s.pkgIndex.NewSet()
    for depID, succ := range n.succs {
        n.ph.depKeys[depID] = succ.ph.key // panic
        reachable.Add(succ.idxID)
crash/crash
runtime.gopanic:+69
runtime.panicmem:=262
runtime.sigpanic:+19
golang.org/x/tools/gopls/internal/cache.(*packageHandleBuilder).evaluatePackageHandle:+26
golang.org/x/tools/gopls/internal/cache.(*packageHandleBuilder).buildPackageHandle:+35
golang.org/x/tools/gopls/internal/cache.(*Snapshot).getPackageHandles.func2.1:+8
golang.org/x/sync/errgroup.(*Group).Go.func1:+3
runtime.goexit:+0
golang.org/x/tools/gopls@v0.16.1 go1.23.0 linux/amd64 vscode (1)
golang.org/x/tools/gopls@v0.16.1 go1.23.0 darwin/arm64 other,vscode (1)

Issue created by golang.org/x/tools/gopls/internal/telemetry/cmd/stacks.

gabyhelp commented 1 month ago

Related Issues and Documentation

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