Skip to content

gopls: automated issue report (crash) #3382

Closed
@tonghia

Description

@tonghia

gopls version: v0.15.3/go1.22.3
gopls flags:
update flags: proxy
extension version: 0.41.4
environment: Visual Studio Code linux
initialization error: undefined
issue timestamp: Thu, 09 May 2024 08:56:59 GMT
restart history:
Thu, 09 May 2024 08:26:00 GMT: activation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

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

goroutine 96339 [running]:
go/token.(*File).Name(...)
	  position.go:109
golang.org/x/tools/gopls/internal/golang.mapPosition({0x1293cc8, 0xc032179e30}, 0x0%3F, {0x128b8a0, 0xc000f8ad80}, 0x0, 0x7)
	  definition.go:301  0x5c
golang.org/x/tools/gopls/internal/golang.OutgoingCalls({0x1293cc8%3F, 0xc032179d10%3F}, 0xc000f8ad80, {0x12966e0, 0xc000aec1e0}, {0x121%3F, 0x0%3F})
	  call_hierarchy.go:282  0xb32
golang.org/x/tools/gopls/internal/server.(*server).OutgoingCalls(0xc0003fa000, {0x1293d00%3F, 0xc0325740f0%3F}, 0xc03144c280)
	  call_hierarchy.go:58  0x195
golang.org/x/tools/gopls/internal/protocol.serverDispatch({0x1293d00, 0xc0325740f0}, {0x12ae940, 0xc0003fa000}, 0xc032179b30, {0x1293ec0, 0xc032568fc0})
	  tsserver.go:131  0x4daa
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3({0x1293d00, 0xc0325740f0}, 0xc032179b30, {0x1293ec0, 0xc032568fc0})
	  protocol.go:160  0x85
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4({0x1293d00, 0xc0325740f0}, 0xc032179b30, {0x1293ec0, 0xc032568fc0})
	  lsprpc.go:509  0x923
golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1({0x1293d00, 0xc0325740f0}, 0xc0320c5038, {0x1293ec0, 0xc032568fc0})
	  handler.go:35  0xc6
golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2()
	  handler.go:103  0x96
created by golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2 in goroutine 141
	  handler.go:100  0x1c5
gopls stats -anon { "DirStats": { "Files": 3916, "TestdataFiles": 0, "GoFiles": 212, "ModFiles": 1, "Dirs": 326 }, "GOARCH": "amd64", "GOOS": "linux", "GOPACKAGESDRIVER": "", "GOPLSCACHE": "", "GoVersion": "go1.22.3", "GoplsVersion": "v0.15.3", "InitialWorkspaceLoadDuration": "3.93463926s", "MemStats": { "HeapAlloc": 107380512, "HeapInUse": 165896192, "TotalAlloc": 1646601960 }, "WorkspaceStats": { "Files": { "Total": 3878, "Largest": 4950165, "Errs": 0 }, "Views": [ { "GoCommandVersion": "go1.22.3", "AllPackages": { "Packages": 717, "LargestPackage": 161, "CompiledGoFiles": 3889, "Modules": 112 }, "WorkspacePackages": { "Packages": 33, "LargestPackage": 52, "CompiledGoFiles": 226, "Modules": 1 }, "Diagnostics": 0 } ] } }

OPTIONAL: If you would like to share more information, you can attach your complete gopls logs.

NOTE: THESE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR CODEBASE.
DO NOT SHARE LOGS IF YOU ARE WORKING IN A PRIVATE REPOSITORY.

<OPTIONAL: ATTACH LOGS HERE>

[Info  - 3:56:57 PM] 2024/05/09 15:56:57 go/packages.Load #1: updating metadata for 717 packages

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

goroutine 96339 [running]:
go/token.(*File).Name(...)
	/usr/local/go/src/go/token/position.go:109
golang.org/x/tools/gopls/internal/golang.mapPosition({0x1293cc8, 0xc032179e30}, 0x0?, {0x128b8a0, 0xc000f8ad80}, 0x0, 0x7)
	/home/username/go/pkg/mod/golang.org/x/tools/[email protected]/internal/golang/definition.go:301 +0x5c
golang.org/x/tools/gopls/internal/golang.OutgoingCalls({0x1293cc8?, 0xc032179d10?}, 0xc000f8ad80, {0x12966e0, 0xc000aec1e0}, {0x121?, 0x0?})
	/home/username/go/pkg/mod/golang.org/x/tools/[email protected]/internal/golang/call_hierarchy.go:282 +0xb32
golang.org/x/tools/gopls/internal/server.(*server).OutgoingCalls(0xc0003fa000, {0x1293d00?, 0xc0325740f0?}, 0xc03144c280)
	/home/username/go/pkg/mod/golang.org/x/tools/[email protected]/internal/server/call_hierarchy.go:58 +0x195
golang.org/x/tools/gopls/internal/protocol.serverDispatch({0x1293d00, 0xc0325740f0}, {0x12ae940, 0xc0003fa000}, 0xc032179b30, {0x1293ec0, 0xc032568fc0})
	/home/username/go/pkg/mod/golang.org/x/tools/[email protected]/internal/protocol/tsserver.go:131 +0x4daa
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3({0x1293d00, 0xc0325740f0}, 0xc032179b30, {0x1293ec0, 0xc032568fc0})
	/home/username/go/pkg/mod/golang.org/x/tools/[email protected]/internal/protocol/protocol.go:160 +0x85
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4({0x1293d00, 0xc0325740f0}, 0xc032179b30, {0x1293ec0, 0xc032568fc0})
	/home/username/go/pkg/mod/golang.org/x/tools/[email protected]/internal/lsprpc/lsprpc.go:509 +0x923
golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1({0x1293d00, 0xc0325740f0}, 0xc0320c5038, {0x1293ec0, 0xc032568fc0})
	/home/username/go/pkg/mod/golang.org/x/[email protected]/internal/jsonrpc2/handler.go:35 +0xc6
golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2()
	/home/username/go/pkg/mod/golang.org/x/[email protected]/internal/jsonrpc2/handler.go:103 +0x96
created by golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2 in goroutine 141
	/home/username/go/pkg/mod/golang.org/x/[email protected]/internal/jsonrpc2/handler.go:100 +0x1c5
[Error - 3:56:59 PM] 

This happen while I was using VSCode debugger and the debugger is pointing at the panic code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateMake it obvious when issues are closed as duplicateFrozenDueToAge

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions