Skip to content

x/tools/internal/lsp: nil pointer panic in definition.go #31604

Closed
@muirdm

Description

@muirdm

gopls occasionally crashes with the below panic. I don't have a repro or even a good description of what I am doing when it happens. I think it happens after files change via version control.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0x13221b1]

goroutine 5 [running]:
golang.org/x/tools/internal/lsp/source.identifier(0x14d4600, 0xc010a35180, 0x14d4780, 0xc0001f8000, 0x14d8000, 0xc000437c20, 0x23c70, 0x18b, 0x44, 0x2fb8)
	/Users/muir/projects/tools/internal/lsp/source/identifier.go:57 +0xc1
golang.org/x/tools/internal/lsp/source.Identifier(0x14d4600, 0xc010a35180, 0x14d4780, 0xc0001f8000, 0x14d8000, 0xc000437c20, 0x23c70, 0x2fb8, 0xc00ccfac80, 0xc0001ae780)
	/Users/muir/projects/tools/internal/lsp/source/identifier.go:40 +0x7d
golang.org/x/tools/internal/lsp.(*Server).hover(0xc0000bc7e0, 0x14d4600, 0xc010a35180, 0xc00c0c4960, 0x0, 0x0, 0xc005ffeaa0)
	/Users/muir/projects/tools/internal/lsp/hover.go:31 +0x24d
golang.org/x/tools/internal/lsp.(*Server).Hover(0xc0000bc7e0, 0x14d4600, 0xc010a35180, 0xc00c0c4960, 0xc00c0c4960, 0x0, 0x0)
	/Users/muir/projects/tools/internal/lsp/server.go:170 +0x49
golang.org/x/tools/internal/lsp/protocol.serverHandler.func1(0x14d4600, 0xc010a35180, 0xc00015a3f0, 0xc006325ec0)
	/Users/muir/projects/tools/internal/lsp/protocol/server.go:248 +0x12bf
golang.org/x/tools/internal/jsonrpc2.(*Conn).Run.func1(0xc000082960, 0xc00015a3f0)
	/Users/muir/projects/tools/internal/jsonrpc2/jsonrpc2.go:276 +0xda
created by golang.org/x/tools/internal/jsonrpc2.(*Conn).Run
	/Users/muir/projects/tools/internal/jsonrpc2/jsonrpc2.go:270 +0xba

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions