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 due to invalid protocol.Range in CodeAction #64085

Closed
adonovan opened this issue Nov 12, 2023 · 1 comment
Closed

x/tools/gopls: crash due to invalid protocol.Range in CodeAction #64085

adonovan opened this issue Nov 12, 2023 · 1 comment
Assignees
Labels
gopls/telemetry-wins gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@adonovan
Copy link
Member

adonovan commented Nov 12, 2023

This stack YPXbAQ was reported by telemetry:

golang.org/x/tools/gopls/internal/bug.report:35
golang.org/x/tools/gopls/internal/bug.Reportf:1
golang.org/x/tools/gopls/internal/lsp/source.FindParam:4
golang.org/x/tools/gopls/internal/lsp.canRemoveParameter:1
golang.org/x/tools/gopls/internal/lsp.refactorRewrite:14
golang.org/x/tools/gopls/internal/lsp.(*Server).codeAction:220
golang.org/x/tools/gopls/internal/lsp.(*Server).CodeAction:1
golang.org/x/tools/gopls/internal/lsp/protocol.serverDispatch:142
golang.org/x/tools/gopls/internal/lsp/lsprpc.(*StreamServer).ServeStream.ServerHandler.func3:5
golang.org/x/tools/gopls/internal/lsp/lsprpc.(*StreamServer).ServeStream.handshaker.func4:52
golang.org/x/tools/gopls/internal/lsp/protocol.Handlers.MustReplyHandler.func1:2
golang.org/x/tools/gopls/internal/lsp/protocol.Handlers.AsyncHandler.func2.2:3

This indicates that the Start or End field of the params.Range provided to CodeAction was invalid, as defined by Mapper.PositionOffset. This is surprising because editor clients presumably pass in-range values (and there's no command for code actions that could provide arbitrary values).

golang.org/x/tools/gopls@v0.14.1 go1.21.3 darwin/arm64 vscode (1)

Duplicates:

This stack 42OsdA was reported by telemetry:

go/ast.Walk:184
go/ast.Inspect:?397
golang.org/x/tools/gopls/internal/lsp.canRemoveParameter:22
golang.org/x/tools/gopls/internal/lsp.refactorRewrite:14
golang.org/x/tools/gopls/internal/lsp.(*Server).codeAction:220
golang.org/x/tools/gopls/internal/lsp.(*Server).CodeAction:1
golang.org/x/tools/gopls/internal/lsp/protocol.serverDispatch:142
golang.org/x/tools/gopls/internal/lsp/lsprpc.(*StreamServer).ServeStream.ServerHandler.func3:5
golang.org/x/tools/gopls/internal/lsp/lsprpc.(*StreamServer).ServeStream.handshaker.func4:52
golang.org/x/tools/gopls/internal/lsp/protocol.Handlers.MustReplyHandler.func1:2
golang.org/x/tools/gopls@v0.14.0 go1.21.3 windows/amd64 vscode (1)

Issue created by golang.org/x/tools/gopls/internal/telemetry/cmd/stacks.

@adonovan adonovan added gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. labels Nov 12, 2023
@gopherbot gopherbot added this to the Unreleased milestone Nov 12, 2023
@adonovan adonovan added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. gopls/telemetry-wins labels Nov 12, 2023
@findleyr findleyr modified the milestones: Unreleased, gopls/v0.15.0 Nov 13, 2023
@adonovan adonovan changed the title x/tools/gopls: crash due to invalid protocol.Range in CodeAction x/tools/gopls: crash due to invalid protocol.Range in CodeAction [YPXbAQ] Nov 17, 2023
@adonovan adonovan changed the title x/tools/gopls: crash due to invalid protocol.Range in CodeAction [YPXbAQ] x/tools/gopls: crash due to invalid protocol.Range in CodeAction Nov 17, 2023
@findleyr
Copy link
Contributor

This bug report was removed in https://go.dev/cl/548738, since it's technically out of our control.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls/telemetry-wins gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. 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