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

Closed
flamelx opened this issue Dec 22, 2021 · 6 comments
Closed

x/tools/gopls: getSnapshot called after shutdown #50327

flamelx opened this issue Dec 22, 2021 · 6 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

@flamelx
Copy link

flamelx commented Dec 22, 2021

gopls version: v0.7.4
gopls flags:
update flags: proxy
extension version: 0.27.2
go version: 1.16.5
environment: Visual Studio Code linux
initialization error: undefined
manual restart count: 4
total start count: 6

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

panic: getSnapshot called after shutdown

goroutine 696 [running]:
golang.org/x/tools/internal/lsp/cache.(*View).getSnapshot(0xc0003ee420, 0x0, 0x0)
	  view.go:564  0x108
golang.org/x/tools/internal/lsp/cache.(*View).Snapshot(0xc0003ee420, 0x10d1180, 0xc000a10240, 0xd19040, 0xc0006f21b0, 0x0)
	  view.go:557  0x2b
golang.org/x/tools/internal/lsp.(*Server).didChangeConfiguration.func1(0x10df008, 0xc0003ee420, 0x10d1180, 0xc000a10240, 0xc0006a6480)
	  workspace.go:83  0x5a
created by golang.org/x/tools/internal/lsp.(*Server).didChangeConfiguration
	  workspace.go:82  0x305
gopls: Unknown command 
The Go Language source tools.

Usage: gopls [flags]  [command-flags] [command-args]

gopls is a Go language server. It is typically used with an editor to provide
language features. When no command is specified, gopls will default to the 'serve'
command. The language features can also be accessed via the gopls command-line interface.

Available commands are:

main:
  serve : run a server for Go code using the Language Server Protocol
  version : print the gopls version information
  bug : report a bug in gopls
  api-json : print json describing gopls API
  licenses : print licenses of included software

features:
  call_hierarchy : display selected identifier's call hierarchy
  check : show diagnostic results for the specified file
  definition : show declaration of selected identifier
  folding_ranges : display selected file's folding ranges
  format : format the code according to the go standard
  highlight : display selected identifier's highlights
  implementation : display selected identifier's implementation
  imports : updates import statements
  remote : interact with the gopls daemon
  inspect : interact with the gopls daemon (deprecated: use 'remote')
  links : list links in a file
  prepare_rename : test validity of a rename operation at location
  references : display selected identifier's references
  rename : rename selected identifier
  semtok : show semantic tokens for the specified file
  signature : display selected identifier's signature
  fix : apply suggested fixes
  symbols : display selected file's symbols
  workspace : manage the gopls workspace (experimental: under development)
  workspace_symbol : search symbols in workspace

gopls flags are:
  -debug string
    	serve debug information on the supplied address
  -listen string
    	address on which to listen for remote connections. If prefixed by 'unix
@findleyr
Copy link
Contributor

Thanks for reporting. This is a new assertion that we've added.

Did this occur while closing/reloading your editor, or restarting the language server?

@findleyr
Copy link
Contributor

I also see that you've manually restarted the language server multiple times. We'd like to (eventually) eliminate the need for doing this; could you describe what led you to restart?

@findleyr findleyr changed the title Dec 22, 2021
@flamelx
Copy link
Author

flamelx commented Dec 22, 2021

Thank you for replying. I have a project that has multiple go.mod files for different packages, so I'm trying to use some experimental features of gopls. The configuration is as follows:

"gopls": {
"build.experimentalWorkspaceModule": false,
"build.expandWorkspaceToModule":false 
}.

Previously this function was working fine, currently there may be some potential misuse resulting in frequent errors of the following form:

err: exit status 1: stderr: go: YYYY@v1.9999999.0-goplsworkspace requires
XXXXX@v1.2.80: reading XXXXX/go.mod at revision v1.2.80: unknown revision v1.2.80
: packages.Load error

In addition the link:#44097 is referenced and does not seem to work.

@findleyr
Copy link
Contributor

Thanks for following up. I'm a bit confused: are you setting experimentalWorkspaceModule to true, or false?

@flamelx
Copy link
Author

flamelx commented Dec 23, 2021

Yes, I set up experimentalWorkspaceModule to true, but it don't seem to work.

@findleyr findleyr transferred this issue from golang/vscode-go Dec 23, 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 Dec 23, 2021
@gopherbot gopherbot added this to the Unreleased milestone Dec 23, 2021
@findleyr findleyr modified the milestones: Unreleased, gopls/v0.7.5 Dec 23, 2021
@gopherbot
Copy link

Change https://golang.org/cl/375875 mentions this issue: internal/lsp: don't get the snapshot asynchronously on config changes

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

3 participants