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: do not block on initial workspace/configuration request #54559

Open
bcmills opened this issue Aug 19, 2022 · 0 comments
Open

x/tools/gopls: do not block on initial workspace/configuration request #54559

bcmills opened this issue Aug 19, 2022 · 0 comments
Assignees
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

@bcmills
Copy link
Member

bcmills commented Aug 19, 2022

~/x/tools/gopls$ go version -m $(which gopls)
/usr/local/google/home/bcmills/bin/gopls: devel go1.20-6001c043dc Fri Aug 19 03:32:27 2022 +0000
        path    golang.org/x/tools/gopls
        mod     golang.org/x/tools/gopls        v0.9.4  h1:YhHOxVi++ILnY+QnH9FGtRKZZrunSaR7OW8/dCp7bBk=
        dep     github.com/BurntSushi/toml      v1.2.0  h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0=
        dep     github.com/google/go-cmp        v0.5.8  h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
        dep     github.com/sergi/go-diff        v1.1.0  h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
        dep     golang.org/x/exp/typeparams     v0.0.0-20220722155223-a9213eeb770e      h1:7Xs2YCOpMlNqSQSmrrnhlzBXIE/bpMecZplbLePTJvE=
        dep     golang.org/x/mod        v0.6.0-dev.0.20220419223038-86c51ed26bb4        h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
        dep     golang.org/x/sync       v0.0.0-20220722155255-886fb9371eb4      h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=
        dep     golang.org/x/sys        v0.0.0-20220722155257-8c9f86f7a55f      h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
        dep     golang.org/x/text       v0.3.7  h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
        dep     golang.org/x/tools      v0.1.13-0.20220812184215-3f9b119300de   h1:b68wxF4nfQjj1XTRHtjVjCximbhAwjztuzDEFGU+n9o=
        dep     golang.org/x/vuln       v0.0.0-20220725105440-4151a5aca1df      h1:BkeW9/QJhcigekDUPS9N9bIb0v7gPKKmLYeczVAqr2s=
        dep     honnef.co/go/tools      v0.3.2  h1:ytYb4rOqyp1TSa2EPvNVwtPQJctSELKaMyLfqNP4+34=
        dep     mvdan.cc/gofumpt        v0.3.1  h1:avhhrOmv0IuvQVK7fvwV91oFSGAk5/6Po8GXTzICeu8=
        dep     mvdan.cc/xurls/v2       v2.4.0  h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
        build   -compiler=gc
        build   CGO_ENABLED=1
        build   CGO_CFLAGS=
        build   CGO_CPPFLAGS=
        build   CGO_CXXFLAGS=
        build   CGO_LDFLAGS=
        build   GOARCH=amd64
        build   GOOS=linux
        build   GOAMD64=v2

GNU Emacs 28.1
eglot built from source at joaotavora/eglot commit 000b7fd.

Does this issue reproduce with the latest release?

Yes.

What did you do?

Use gopls with eglot for a large stack of changes in the module at GOROOT/src/cmd.

What did you expect to see?

Responsive gopls actions via eglot.

What did you see instead?

M-x eglot-format-buffer frequently and consistently times out. On further investigation (details in joaotavora/eglot#587 (comment)), I found what appears to be a distributed deadlock.

  • gopls is blocking its responses pending a reply to its workspace/configuration request.
  • It appears that eglot is failing to process the workspace/configuration request because it is still awaiting a response for its own textDocument/documentSymbol request.

The LSP specification recommends that clients and servers be implemented asynchronously, so I believe that both programs are in some sense in the wrong here: eglot should not block on a response to its documentSymbol request, but neither should gopls block on a response to its configuration request.

Instead, gopls should either serve best-effort results for the documentSymbol request without more detailed configuration, or it should serve an explicit error in order to resolve any intervening requests from the client.

(I believe that joaotavora/eglot#587 tracks the corresponding bug on the eglot side.)

@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 Aug 19, 2022
@gopherbot gopherbot added this to the Unreleased milestone Aug 19, 2022
@suzmue suzmue modified the milestones: Unreleased, gopls/later Aug 22, 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

4 participants