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: invalid memory address or nil pointer dereference in internal/lsp/source.HoverIdentifier #44189

Closed
dazoe opened this issue Feb 9, 2021 · 3 comments
Labels
FrozenDueToAge 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

@dazoe
Copy link

dazoe commented Feb 9, 2021

gopls version: v0.6.5
gopls flags:
extension version: 0.22.0
environment: Code - OSS

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

changed "ui.navigation.importShortcut" to "Link", then tried to ctrl click on import statement.
seem the crash can also be triggered just by hovering over the import statement as well

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

goroutine 3816 [running]:
golang.org/x/tools/internal/lsp/source.HoverIdentifier(0xef7cb8, 0xc00318e570, 0x0, 0x0, 0x0, 0x0)
	  hover.go:93  0xd2
golang.org/x/tools/internal/lsp/source.Hover(0xef7cb8, 0xc0059d23c0, 0xf09000, 0xc0003562a0, 0xefb798, 0xc0011610e0, 0x4020000000000000, 0x4042800000000000, 0xf00838, 0xc0011610e0, ...)
	  hover.go:64  0xdb
golang.org/x/tools/internal/lsp.(*Server).hover(0xc00017c2a0, 0xef7cb8, 0xc0059d23c0, 0xc00318e030, 0x0, 0x0, 0x0)
	  hover.go:25  0x2ce
golang.org/x/tools/internal/lsp.(*Server).Hover(0xc00017c2a0, 0xef7cb8, 0xc0059d23c0, 0xc00318e030, 0xc00318e030, 0x0, 0x0)
	  server_gen.go:100  0x49
golang.org/x/tools/internal/lsp/protocol.serverDispatch(0xef7cb8, 0xc0059d23c0, 0xf0b888, 0xc00017c2a0, 0xc00318e000, 0xef7eb0, 0xc0059d20c0, 0x203000, 0xee7080, 0xc000010020)
	  tsserver.go:299  0x1b85
golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1(0xef7cb8, 0xc0059d23c0, 0xc00318e000, 0xef7eb0, 0xc0059d20c0, 0xc000afbd006bef77, 0x3f797d89)
	  protocol.go:63  0xc5
golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1(0xef7cb8, 0xc0059d23c0, 0xc00318e000, 0xef7eb0, 0xc0059d20c0, 0x0, 0x0)
	  lsprpc.go:560  0x452
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1(0xef7cb8, 0xc0059d23c0, 0xc00362b740, 0xef7eb0, 0xc0059d20c0, 0xc005ff9cf0, 0x443d36)
	  handler.go:35  0xd7
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2(0xc0089fe7e0, 0xc0021ccc90, 0xc000826150, 0xef7cb8, 0xc0059d23c0, 0xc00362b740, 0xef7eb0, 0xc0059d20c0)
	  handler.go:103  0x86
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
	  handler.go:100  0x173
[Error - 2:27:32 AM] 
@hyangah hyangah changed the title gopls: automated issue report (crash) x/tools/gopls: invalid memory address or nil pointer dereference in internal/lsp/source.HoverIdentifier Feb 9, 2021
@hyangah
Copy link
Contributor

hyangah commented Feb 9, 2021

Thanks for the report @dazoe! Transferring to the gopls issue tracker.

@hyangah hyangah transferred this issue from golang/vscode-go Feb 9, 2021
@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 Feb 9, 2021
@gopherbot gopherbot added this to the Unreleased milestone Feb 9, 2021
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.6.6 Feb 9, 2021
@gopherbot
Copy link

Change https://golang.org/cl/290789 mentions this issue: internal/lsp: handle nil pointer with import shortcut = link

@gopherbot
Copy link

Change https://golang.org/cl/292729 mentions this issue: internal/lsp: handle nil pointer with import shortcut = link

gopherbot pushed a commit to golang/tools that referenced this issue Feb 17, 2021
It makes more sense to handle the import shortcut behavior at a higher
level anyway, so pull it out of findIdentifier and add a test for the
configuration.

Fixes golang/go#44189

Change-Id: I96f08c7def154f6761efa727d693fdfb2fb722ab
Reviewed-on: https://go-review.googlesource.com/c/tools/+/290789
Trust: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
(cherry picked from commit fca8992)
Reviewed-on: https://go-review.googlesource.com/c/tools/+/292729
Reviewed-by: Robert Findley <rfindley@google.com>
@golang golang locked and limited conversation to collaborators Feb 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge 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