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: nil pointer deference in semanticTokensRange when viewing git diff #41873

Closed
zikaeroh opened this issue Oct 9, 2020 · 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

@zikaeroh
Copy link
Contributor

zikaeroh commented Oct 9, 2020

ATTENTION: Please answer these questions BEFORE submitting your issue. Thanks!

What did you do?

Opened up VS Code's git diff viewer. I also run the nightly extension (which IIRC now includes semantic tokens support via an updated LSP client).

What did you expect to see?

No crash.

What did you see instead?

The server crashes with the diff open.

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

goroutine 124 [running]:
golang.org/x/tools/internal/lsp.(*Server).semanticTokensRange(0xc0000e0bb0, 0xef58e0, 0xc00046e500, 0xc0063d9220, 0x0, 0x0, 0xc00123c160)
	/home/jake/go/pkg/mod/golang.org/x/tools@v0.0.0-20201009010951-9ab7e515274e/internal/lsp/semantic.go:44 +0x191
golang.org/x/tools/internal/lsp.(*Server).SemanticTokensRange(0xc0000e0bb0, 0xef58e0, 0xc00046e500, 0xc0063d9220, 0xc0063d9220, 0x0, 0x0)
	/home/jake/go/pkg/mod/golang.org/x/tools@v0.0.0-20201009010951-9ab7e515274e/internal/lsp/server_gen.go:176 +0x49
golang.org/x/tools/internal/lsp/protocol.serverDispatch(0xef58e0, 0xc00046e500, 0xf09480, 0xc0000e0bb0, 0xc0063ec270, 0xef5b20, 0xc00046e480, 0x0, 0xee2e00, 0xc00123c000)
	/home/jake/go/pkg/mod/golang.org/x/tools@v0.0.0-20201009010951-9ab7e515274e/internal/lsp/protocol/tsserver.go:253 +0x5f92
golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1(0xef58e0, 0xc00046e500, 0xc0063ec270, 0xef5b20, 0xc00046e480, 0x328fc423, 0x134fde0)
	/home/jake/go/pkg/mod/golang.org/x/tools@v0.0.0-20201009010951-9ab7e515274e/internal/lsp/protocol/protocol.go:63 +0xc5
golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1(0xef58e0, 0xc00046e500, 0xc0063ec270, 0xef5b20, 0xc00046e480, 0x0, 0x0)
	/home/jake/go/pkg/mod/golang.org/x/tools@v0.0.0-20201009010951-9ab7e515274e/internal/lsp/lsprpc/lsprpc.go:557 +0x452
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1(0xef58e0, 0xc00046e500, 0xc0003e5580, 0xef5b20, 0xc00046e480, 0x0, 0x0)
	/home/jake/go/pkg/mod/golang.org/x/tools@v0.0.0-20201009010951-9ab7e515274e/internal/jsonrpc2/handler.go:35 +0xcf
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2(0xc00028ed20, 0xc0004382a0, 0xc0005be3e0, 0xef58e0, 0xc00046e500, 0xc0003e5580, 0xef5b20, 0xc00046e480)
	/home/jake/go/pkg/mod/golang.org/x/tools@v0.0.0-20201009010951-9ab7e515274e/internal/jsonrpc2/handler.go:103 +0x86
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
	/home/jake/go/pkg/mod/golang.org/x/tools@v0.0.0-20201009010951-9ab7e515274e/internal/jsonrpc2/handler.go:100 +0x173
[Error - 7:24:29 PM] Connection to server got closed. Server will not be restarted.

Logs: https://gist.github.com/zikaeroh/96741da55aad5964576e0aba864cbeb3

Build info

golang.org/x/tools/gopls master
    golang.org/x/tools/gopls@v0.0.0-20201009010951-9ab7e515274e h1:Fxf8D75bsdvDgLpM6enYCHxPn+lFAiEBFAvdk/0UJ7s=
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/google/go-cmp@v0.5.1 h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k=
    github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/mod@v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
    golang.org/x/sync@v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA=
    golang.org/x/tools@v0.0.0-20201009010951-9ab7e515274e h1:x1hHgXABYbwIYbEYxs6ypae/tryqQ7YQ1/DwGyKp4Ok=
    golang.org/x/xerrors@v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
    honnef.co/go/tools@v0.0.1-2020.1.5 h1:nI5egYTGJakVyOryqLs1cQO5dO0ksin5XXs2pspk75k=
    mvdan.cc/gofumpt@v0.0.0-20200802201014-ab5a8192947d h1:t8TAw9WgTLghti7RYkpPmqk4JtQ3+wcP5GgZqgWeWLQ=
    mvdan.cc/xurls/v2@v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=
@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 Oct 9, 2020
@gopherbot gopherbot added this to the Unreleased milestone Oct 9, 2020
@zikaeroh zikaeroh changed the title x/tools/gopls: nil pointer deference when viewing git diff in semanticTokensRange x/tools/gopls: nil pointer deference in semanticTokensRange when viewing git diff Oct 9, 2020
@stamblerre
Copy link
Contributor

/cc @pjweinb

@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.5.2 Oct 9, 2020
@gopherbot
Copy link

Change https://golang.org/cl/260806 mentions this issue: internal/lsp: handle nil pointer in semantic tokens

@zikaeroh
Copy link
Contributor Author

Note that the same thing seems to happen when you open up a go.mod file; not sure if it's the same fix or not.

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

3 participants