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: getSnapshot called after shutdown #56466

Open
hyangah opened this issue Oct 28, 2022 · 0 comments
Open

x/tools/gopls: panic: getSnapshot called after shutdown #56466

hyangah opened this issue Oct 28, 2022 · 0 comments
Labels
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

@hyangah
Copy link
Contributor

hyangah commented Oct 28, 2022

gopls version

Both v0.9.5 and v0.10.0-pre.3

What did you do?

While using it with vscode-go dev version, fiddle with settings.json (e.g. go.languageServerFlags or go.toolsEnvVars) that triggers gopls restart.

What did you expect to see?

No panic

What did you see instead?

[Trace - 00:31:19.530 AM] Sending notification 'workspace/didChangeConfiguration'.
Params: {"settings":null}


[Trace - 00:31:19.531 AM] Sending request 'shutdown - (1)'.
Params: 


[Trace - 00:31:19.531 AM] Received request 'workspace/configuration - (5)'.
Params: {"items":[{"section":"gopls"}]}


[Trace - 00:31:19.535 AM] Sending response 'workspace/configuration - (5)' in 4ms.
Result: [{"ui.semanticTokens":true,"ui.codelenses":{"run_vulncheck_exp":true},"ui.inlayhint.hints":{"assignVariableTypes":false,"compositeLiteralFields":false,"compositeLiteralTypes":false,"constantValues":false,"functionTypeParameters":false,"parameterNames":true,"rangeVariableTypes":false},"allExperiments":true}]


[Trace - 00:31:19.535 AM] Received request 'workspace/configuration - (6)'.
Params: {"items":[{"scopeUri":"file:///Users/hakim/bugbash/govulncheck-study/module4","section":"gopls"}]}


[Trace - 00:31:19.537 AM] Sending response 'workspace/configuration - (6)' in 1ms.
Result: [{"ui.semanticTokens":true,"ui.codelenses":{"run_vulncheck_exp":true},"ui.inlayhint.hints":{"assignVariableTypes":false,"compositeLiteralFields":false,"compositeLiteralTypes":false,"constantValues":false,"functionTypeParameters":false,"parameterNames":true,"rangeVariableTypes":false},"allExperiments":true}]


panic: getSnapshot called after shutdown

goroutine 2334 [running]:
golang.org/x/tools/gopls/internal/lsp/cache.(*View).getSnapshot(0xc0000f4600)
	/Users/hakim/go/pkg/mod/golang.org/x/tools/gopls@v0.10.0-pre.3/internal/lsp/cache/view.go:627 +0xfb
golang.org/x/tools/gopls/internal/lsp/cache.(*View).Snapshot(0x4d3aac0?, {0xc001240bd0?, 0xc0001623a8?})
	/Users/hakim/go/pkg/mod/golang.org/x/tools/gopls@v0.10.0-pre.3/internal/lsp/cache/view.go:620 +0x19
golang.org/x/tools/gopls/internal/lsp.(*Server).didChangeConfiguration.func1()
	/Users/hakim/go/pkg/mod/golang.org/x/tools/gopls@v0.10.0-pre.3/internal/lsp/workspace.go:66 +0x48
created by golang.org/x/tools/gopls/internal/lsp.(*Server).didChangeConfiguration
	/Users/hakim/go/pkg/mod/golang.org/x/tools/gopls@v0.10.0-pre.3/internal/lsp/workspace.go:65 +0x61c
[Error - 12:31:19 AM] Connection to server got closed. Server will not be restarted.

Looks like #52543 wasn't fixed -- I tested with gopls v0.9.5 and saw

panic: getSnapshot called after shutdown

goroutine 2453 [running]:
golang.org/x/tools/internal/lsp/cache.(*View).getSnapshot(0xc000268000)
	/Users/hakim/go/pkg/mod/golang.org/x/tools@v0.1.13-0.20220908144252-ce397412b6a4/internal/lsp/cache/view.go:629 +0xfb
golang.org/x/tools/internal/lsp/cache.(*View).Snapshot(0xc000b47fd0?, {0x1274f97?, 0xc000017890?})
	/Users/hakim/go/pkg/mod/golang.org/x/tools@v0.1.13-0.20220908144252-ce397412b6a4/internal/lsp/cache/view.go:622 +0x19
golang.org/x/tools/internal/lsp.(*Server).didChangeConfiguration.func1()
	/Users/hakim/go/pkg/mod/golang.org/x/tools@v0.1.13-0.20220908144252-ce397412b6a4/internal/lsp/workspace.go:66 +0x48
created by golang.org/x/tools/internal/lsp.(*Server).didChangeConfiguration
	/Users/hakim/go/pkg/mod/golang.org/x/tools@v0.1.13-0.20220908144252-ce397412b6a4/internal/lsp/workspace.go:65 +0x63b
@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 28, 2022
@gopherbot gopherbot added this to the Unreleased milestone Oct 28, 2022
@hyangah hyangah modified the milestones: Unreleased, gopls/v0.11.0 Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

2 participants