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: automated issue report (crash) #48492

Closed
stamblerre opened this issue Sep 17, 2021 · 4 comments
Closed

x/tools/gopls: automated issue report (crash) #48492

stamblerre opened this issue Sep 17, 2021 · 4 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

@stamblerre
Copy link
Contributor

gopls version: (devel)
gopls flags: -rpc.trace --debug=localhost:6060
update flags: proxy
extension version: 2021.9.1523
go version: devel go1.18-f9271e4f85
environment: Visual Studio Code - Insiders darwin
initialization error: undefined
issue timestamp: Fri, 17 Sep 2021 19:59:46 GMT
restart history:
Fri, 17 Sep 2021 19:51:02 GMT: activation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

panic: runtime error: slice bounds out of range [4294967281:152]

goroutine 17124 [running]:
golang.org/x/tools/internal/lsp/source.findRune({0x1b71740, 0xc015308360}, {0x1b9adc0, 0xc00670e500}, {0x1b7d918, 0xc005a2d380}, {0x153080f0, 0xc0})
	  hover.go:216  0x100d
golang.org/x/tools/internal/lsp/source.hoverRune({0x1b71698, 0xc006e28080}, {0x1b9adc0, 0xc00670e500}, {0x1b7d918, 0xc005a2d380}, {0x13b9b6a8, 0xc0})
	  hover.go:106  0xe5
golang.org/x/tools/internal/lsp/source.Hover({0x1b71698, 0xc006e28080}, {0x1b9adc0, 0xc00670e500}, {0x1b7d918, 0xc005a2d380}, {0x17f7c40, 0x0})
	  hover.go:72  0xab
golang.org/x/tools/internal/lsp.(*Server).hover(0xc011df5228, {0x1b71698, 0xc006e28080}, 0xc015308030)
	  hover.go:26  0x25c
golang.org/x/tools/internal/lsp.(*Server).Hover(0xc008d58000, {0x1b71698, 0xc006e28080}, 0x17f7c40)
	  server_gen.go:128  0x25
golang.org/x/tools/internal/lsp/protocol.serverDispatch({0x1b71698, 0xc006e28080}, {0x1b9ec20, 0xc0002e1440}, 0xc015308000, {0x1b71900, 0xc006e28000})
	  tsserver.go:372  0x12da
golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1({0x1b71698, 0xc006e28080}, 0xc015308000, {0x1b71900, 0xc006e28000})
	  protocol.go:154  0x90
golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1({0x1b71698, 0xc006e28080}, 0xc015308000, {0x1b71900, 0xc006e28000})
	  lsprpc.go:506  0xa43
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1({0x1b71698, 0xc006e28080}, 0xc0153050e0, {0x1b71900, 0xc006e28000})
	  handler.go:35  0xf6
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2()
	  handler.go:103  0xa3
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
	  handler.go:100  0x20a
[Error - 3:59: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>

@stamblerre stamblerre self-assigned this Sep 20, 2021
@stamblerre stamblerre transferred this issue from golang/vscode-go Sep 20, 2021
@stamblerre stamblerre changed the title gopls: automated issue report (crash) x/tools/gopls: automated issue report (crash) Sep 20, 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 Sep 20, 2021
@gopherbot gopherbot added this to the Unreleased milestone Sep 20, 2021
@suzmue suzmue modified the milestones: Unreleased, gopls/on-deck Sep 20, 2021
@bcmills
Copy link
Contributor

bcmills commented Sep 22, 2021

That looks like an unsigned integer overflow. (4294967281 = 2³² - 15)

@leitzler
Copy link
Contributor

FWIW I just ran into this as well and narrowed it down to a small repro:

-- go.mod --
module x

go 1.18
-- main.go --
package main

func main() {
    const x = `
    foo
    `
}

And call hover with cursor over foo.

% go version
go version devel go1.18-b1bedc0774 Thu Sep 16 17:44:44 2021 +0000 darwin/amd64
panic: runtime error: slice bounds out of range [4294967288:15]

goroutine 1713 [running]:
golang.org/x/tools/internal/lsp/source.findRune({0x1b72ec0, 0xc002954360}, {0x1b9c520, 0xc002872000}, {0x1b7f098, 0xc00027e5a0}, {0x29540f0, 0xc0})
   /Users/leitzler/go/pkg/mod/golang.org/x/tools@v0.1.7-0.20210919163452-7559231edc43/internal/lsp/source/hover.go:216 +0x100d
golang.org/x/tools/internal/lsp/source.hoverRune({0x1b72e18, 0xc00276db80}, {0x1b9c520, 0xc002872000}, {0x1b7f098, 0xc00027e5a0}, {0x2a236a8, 0xc0})
   /Users/leitzler/go/pkg/mod/golang.org/x/tools@v0.1.7-0.20210919163452-7559231edc43/internal/lsp/source/hover.go:106 +0xe5
golang.org/x/tools/internal/lsp/source.Hover({0x1b72e18, 0xc00276db80}, {0x1b9c520, 0xc002872000}, {0x1b7f098, 0xc00027e5a0}, {0x17f8e60, 0x0})
   /Users/leitzler/go/pkg/mod/golang.org/x/tools@v0.1.7-0.20210919163452-7559231edc43/internal/lsp/source/hover.go:72 +0xab
golang.org/x/tools/internal/lsp.(*Server).hover(0xc002717df8, {0x1b72e18, 0xc00276db80}, 0xc002954030)
   /Users/leitzler/go/pkg/mod/golang.org/x/tools@v0.1.7-0.20210919163452-7559231edc43/internal/lsp/hover.go:26 +0x25c
golang.org/x/tools/internal/lsp.(*Server).Hover(0xc001302000, {0x1b72e18, 0xc00276db80}, 0x17f8e60)
   /Users/leitzler/go/pkg/mod/golang.org/x/tools@v0.1.7-0.20210919163452-7559231edc43/internal/lsp/server_gen.go:128 +0x25
golang.org/x/tools/internal/lsp/protocol.serverDispatch({0x1b72e18, 0xc00276db80}, {0x1ba0380, 0xc00023f0e0}, 0xc002954000, {0x1b73080, 0xc00276db00})
   /Users/leitzler/go/pkg/mod/golang.org/x/tools@v0.1.7-0.20210919163452-7559231edc43/internal/lsp/protocol/tsserver.go:372 +0x12da
golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1({0x1b72e18, 0xc00276db80}, 0xc002954000, {0x1b73080, 0xc00276db00})
   /Users/leitzler/go/pkg/mod/golang.org/x/tools@v0.1.7-0.20210919163452-7559231edc43/internal/lsp/protocol/protocol.go:154 +0x90
golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1({0x1b72e18, 0xc00276db80}, 0xc002954000, {0x1b73080, 0xc00276db00})
   /Users/leitzler/go/pkg/mod/golang.org/x/tools@v0.1.7-0.20210919163452-7559231edc43/internal/lsp/lsprpc/lsprpc.go:506 +0xa43
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1({0x1b72e18, 0xc00276db80}, 0xc002735f98, {0x1b73080, 0xc00276db00})
   /Users/leitzler/go/pkg/mod/golang.org/x/tools@v0.1.7-0.20210919163452-7559231edc43/internal/jsonrpc2/handler.go:35 +0xf6
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2()
   /Users/leitzler/go/pkg/mod/golang.org/x/tools@v0.1.7-0.20210919163452-7559231edc43/internal/jsonrpc2/handler.go:103 +0xa3
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
   /Users/leitzler/go/pkg/mod/golang.org/x/tools@v0.1.7-0.20210919163452-7559231edc43/internal/jsonrpc2/handler.go:100 +0x20a

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/351629 mentions this issue: internal/lsp: handle panic in hoverRune by using token.Pos

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/351649 mentions this issue: internal/lsp: handle panic in hoverRune by using token.Pos

@golang golang locked and limited conversation to collaborators Sep 24, 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

5 participants