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: panic in semantic tokens #51731

Closed
suzmue opened this issue Mar 16, 2022 · 3 comments
Closed

x/tools/gopls: panic in semantic tokens #51731

suzmue opened this issue Mar 16, 2022 · 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

@suzmue
Copy link
Contributor

suzmue commented Mar 16, 2022

Copying this issue from @nicolasparada in vscode-go repo (golang/vscode-go#2113):

gopls version: v0.8.1 (go1.18)
gopls flags:
update flags: proxy
extension version: 0.32.0
go version: 1.18
environment: Visual Studio Code darwin
initialization error: undefined
issue timestamp: Wed, 16 Mar 2022 18:06:38 GMT
restart history:
Wed, 16 Mar 2022 18:06:29 GMT: activation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

panic: runtime error: slice bounds out of range [482:37]

goroutine 3437 [running]:
golang.org/x/tools/internal/lsp/template.(*Parsed).RuneCount(0x1400216cc80%3F, 0x26a%3F, 0x0%3F, 0x280%3F)
parse.go:301 0xd0
golang.org/x/tools/internal/lsp/template.SemanticTokens({0x100fd8548%3F, 0x14006cb4000%3F}, {0x100fdfd28%3F, 0x14000346240%3F}, {0x14000338690%3F, 0x0%3F}, 0x14000859558, 0x14000859548)
implementations.go:169 0x2f0
golang.org/x/tools/internal/lsp.(*Server).computeSemanticTokens(0x14000000360, {0x100fd8548%3F, 0x14006cb4000}, {{0x1400215bc20%3F, 0x1%3F}}, 0x0)
semantic.go:89 0x714
golang.org/x/tools/internal/lsp.(*Server).semanticTokensFull(...)
semantic.go:40
golang.org/x/tools/internal/lsp.(*Server).SemanticTokensFull(0x14006db1140%3F, {0x100fd8548%3F, 0x14006cb4000%3F}, 0x100e98fa0%3F)
server_gen.go:240 0x38
golang.org/x/tools/internal/lsp/protocol.serverDispatch({0x100fd8548, 0x14006cb4000}, {0x100fe23d8, 0x14000000360}, 0x14002fa7830, {0x100fd87b0, 0x14003bf5f80})
tsserver.go:304 0x394c
golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1({0x100fd8548, 0x14006cb4000}, 0x14002fa7830, {0x100fd87b0, 0x14003bf5f80})
protocol.go:154 0x70
golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1({0x100fd8548, 0x14006cb4000}, 0x14002fa7830, {0x100fd87b0%3F, 0x14003bf5f80%3F})
lsprpc.go:506 0x788
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1({0x100fd8548, 0x14006cb4000}, 0x14002d40990, {0x100fd87b0%3F, 0x14003bf5f80%3F})
handler.go:35 0xf4
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2()
handler.go:103 0x90
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
handler.go:100 0x1dc
[Error - 3:06:34 PM]
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>

@suzmue suzmue added this to the gopls/v0.8.2 milestone Mar 16, 2022
@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 Mar 16, 2022
@pjweinb pjweinb self-assigned this Mar 16, 2022
@pjweinb
Copy link

pjweinb commented Mar 16, 2022

I can reproduce the failure. I don't think we need any more information.

@gopherbot
Copy link

Change https://go.dev/cl/393634 mentions this issue: internal/lsp/template: fix processing of multi-line tokens

AlekSi pushed a commit to AlekSi/tools that referenced this issue Mar 17, 2022
Aside from the logic error, the root flaw was inadequate
test coverage.

Fixes golang/go#51731

Change-Id: I50787a951ab742700d9890b4b5232e90189cb8ee
Reviewed-on: https://go-review.googlesource.com/c/tools/+/393634
Run-TryBot: Peter Weinberger <pjw@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Peter Weinberger <pjw@google.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
@findleyr
Copy link
Contributor

@pjweinb I think this can now be closed. Please reopen if I'm misunderstanding.

@rsc rsc unassigned pjweinb Jun 22, 2022
@golang golang locked and limited conversation to collaborators Jun 22, 2023
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