Skip to content
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

x/tools/gopls: crash in typeparams.Free.Has (empty type set) #68213

Closed
IvanBelyakoff opened this issue Jun 27, 2024 · 4 comments
Closed

x/tools/gopls: crash in typeparams.Free.Has (empty type set) #68213

IvanBelyakoff opened this issue Jun 27, 2024 · 4 comments
Assignees
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@IvanBelyakoff
Copy link

gopls version: v0.16.0/go1.22.3
gopls flags:
update flags: proxy
extension version: 0.41.4
environment: Visual Studio Code darwin
initialization error: undefined
issue timestamp: Thu, 27 Jun 2024 11:16:18 GMT
restart history:
Mon, 24 Jun 2024 09:52:12 GMT: activation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

panic: empty type set

goroutine 10038 [running]:
golang.org/x/tools/internal/typeparams.(*Free).Has(0x1400a0e7038, {0x101ca13d0, 0x14009d8f8b0})
	  free.go:86  0x66c
golang.org/x/tools/internal/typeparams.(*Free).Has(0x1400a0e7038, {0x101ca2528, 0x1400a306b60})
	  free.go:111  0x534
golang.org/x/tools/internal/typeparams.(*Free).Has(0x1400a0e7038, {0x101ca2410, 0x1400aad8ae0})
	  free.go:52  0x6bc
golang.org/x/tools/internal/typeparams.(*Free).Has(0x1400a0e7038, {0x101ca2528, 0x1400a306d20})
	  free.go:111  0x534
golang.org/x/tools/gopls/internal/golang.computeSizeOffsetInfo(0x1400aa21980, {0x1400a94db80, 0x4, 0x21e2%3F}, {0x101cb2f98, 0x14009d8f590%3F})
	  hover.go:1405  0xc4
golang.org/x/tools/gopls/internal/golang.hover({0x101ca6108, 0x1400bf40c90}, 0x1400a75f9e0, {0x101ca8e20, 0x1400a1bf620}, {0xa0e75e0%3F, 0x140%3F})
	  hover.go:318  0x9d4
golang.org/x/tools/gopls/internal/golang.Hover({0x101ca6108%3F, 0x1400bf40ab0%3F}, 0x1400a75f9e0, {0x101ca8e20, 0x1400a1bf620}, {0x4%3F, 0x0%3F}, 0x0)
	  hover.go:107  0x8c
golang.org/x/tools/gopls/internal/server.(*server).Hover(0x14000192600, {0x101ca6108, 0x1400bf40ab0}, 0x1400bf40810)
	  hover.go:51  0x2dc
golang.org/x/tools/gopls/internal/protocol.serverDispatch({0x101ca6140, 0x1400a55d590}, {0x101cc0050, 0x14000192600}, 0x1400bf407e0, {0x101ca6300, 0x14007d8a100})
	  tsserver.go:503  0xc70
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3({0x101ca6140, 0x1400a55d590}, 0x1400bf407e0, {0x101ca6300, 0x14007d8a100})
	  protocol.go:160  0x74
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4({0x101ca6140, 0x1400a55d590}, 0x1400bf407e0, {0x101ca6300, 0x14007d8a100})
	  lsprpc.go:509  0x6e0
golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1({0x101ca6140, 0x1400a55d590}, 0x1400a5695a8, {0x101ca6300, 0x14007d8a100})
	  handler.go:35  0xc0
golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2()
	  handler.go:103  0x90
created by golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2 in goroutine 118
	  handler.go:100  0x19c
gopls stats -anon { "DirStats": { "Files": 11991, "TestdataFiles": 3, "GoFiles": 7496, "ModFiles": 4, "Dirs": 1669 }, "GOARCH": "arm64", "GOOS": "darwin", "GOPACKAGESDRIVER": "", "GOPLSCACHE": "", "GoVersion": "go1.22.3", "GoplsVersion": "v0.16.0", "InitialWorkspaceLoadDuration": "3.408558708s", "MemStats": { "HeapAlloc": 110704344, "HeapInUse": 157474816, "TotalAlloc": 1666178736 }, "WorkspaceStats": { "Files": { "Total": 6634, "Largest": 8827634, "Errs": 0 }, "Views": [ { "GoCommandVersion": "go1.22.3", "AllPackages": { "Packages": 1343, "LargestPackage": 166, "CompiledGoFiles": 7230, "Modules": 240 }, "WorkspacePackages": { "Packages": 3, "LargestPackage": 22, "CompiledGoFiles": 45, "Modules": 1 }, "Diagnostics": 0 } ] } }
@findleyr
Copy link
Contributor

Thanks for the report, moving this to the github issue tracker since it is a bug in gopls.

@findleyr findleyr changed the title gopls: automated issue report (crash) x/tools/gopls: crash in typeparams.Free.Has (empty type set) Jun 27, 2024
@findleyr findleyr transferred this issue from golang/vscode-go Jun 27, 2024
@findleyr findleyr added this to the gopls/v0.16.1 milestone Jun 27, 2024
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Jun 27, 2024
@findleyr findleyr self-assigned this Jun 27, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/595555 mentions this issue: internal/typeparams: fix crash in interface hover with empty type set

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/595556 mentions this issue: [gopls-release-branch.0.16] internal/typeparams: fix crash in interface hover with empty type set

gopherbot pushed a commit to golang/tools that referenced this issue Jun 28, 2024
…ce hover with empty type set

The logic of typeparams.Free.Has was not handling ErrEmptyTypeSet from
InterfaceTermSet, leading to a crash.

Also fix a hover marker in hover/generics.txt that was apparently
missing a '@'.

For the cherry pick: add back the replace directive.

Fixes golang/go#68213

Change-Id: I0e264b5c5f5ecc0d09a0b8ab381eb7d7c492c18f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/595555
Auto-Submit: Robert Findley <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Alan Donovan <[email protected]>
(cherry picked from commit 72edac2)
Reviewed-on: https://go-review.googlesource.com/c/tools/+/595556
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jul 7, 2024
This release addresses the following gopls issues:

    golang/go#68116, broken links to dependencies in the new integrated doc viewer.
    golang/go#68169, a crash in package name completion.
    golang/go#68213, a crash when hovering over an interface with an empty type set.
    golang/go#68240, additional telemetry instrumentation to help inform decisions for [email protected]. (Note that this is local instrumentation only; a separate proposal will be filed to allow collection of this data from users who have opted in to sharing their telemetry data).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants