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/cmd/gopls: no reply to shutdown request #31333

Closed
hbar-x-2pi opened this issue Apr 8, 2019 · 6 comments
Closed

x/tools/cmd/gopls: no reply to shutdown request #31333

hbar-x-2pi opened this issue Apr 8, 2019 · 6 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls.
Milestone

Comments

@hbar-x-2pi
Copy link

What version of Go are you using (go version)?

go version go1.12 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
GOARCH="amd64"
GOOS="linux"

What did you do?

Emacs (lsp-mode) hangs when closing a go file. The problem seems to be caused by the fact that in the current implementation:
https://github.com/golang/tools/blob/0fdf0c73855bae8482c5d3907a9e06f33ff70a10/internal/lsp/protocol/server.go#L79-L86

gopls does not reply to the shutdown request.

What did you expect to see?

According to the specification gopls should reply to the shutdown request.

Adding the following to the code fragment linked above solved this problem.

 else {
	conn.Reply(ctx, r, nil, nil)
}

This is just a quick workaround. The error should also be sent to the client and more importantly the server should reject other requests in between shutdown and exit with an InvalidRequest.

@ianthehat ianthehat self-assigned this Apr 8, 2019
@ianthehat ianthehat added the gopls Issues related to the Go language server, gopls. label Apr 8, 2019
@ianthehat
Copy link

This is clearly something we need to fix, but I am also interested to know why/when emacs shuts down the language server.
Restarting a language server is a very heavy weight operation, as it has to re-populate all it's caches, I want to make sure that emacs is not doing this in a way that is going to cause significant performance problems.

@hbar-x-2pi
Copy link
Author

This happens when Emacs exits normally. I noticed that it got stuck for 20s (approx) after C-x C-c.

There are more problems with the lsp-mode emacs interaction but I need more time to investigate. gopls dies from time to time and haven't yet figured out what is causing it.

@odeke-em odeke-em changed the title gopls does not reply to shutdown request x/tools/cmd/gopls: no reply to shutdown request Apr 9, 2019
@gopherbot gopherbot added this to the Unreleased milestone Apr 9, 2019
@gopherbot
Copy link

Change https://golang.org/cl/172639 mentions this issue: internal/lsp: reply to shutdown request

@pekim
Copy link

pekim commented May 11, 2019

I think that this fix has been lost, probably in golang/tools@08ecc9ed.

@stamblerre
Copy link
Contributor

/cc @pjweinb

@stamblerre stamblerre reopened this May 13, 2019
@gopherbot
Copy link

Change https://golang.org/cl/176921 mentions this issue: internal/lsp: respond to shutdown requests and add DO NOT EDITs

@golang golang locked and limited conversation to collaborators May 12, 2020
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.
Projects
None yet
Development

No branches or pull requests

5 participants