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: returns with non-0 exit code on server restart / shutdown #40832

rchl opened this issue Aug 16, 2020 · 3 comments

x/tools/gopls: returns with non-0 exit code on server restart / shutdown #40832

rchl opened this issue Aug 16, 2020 · 3 comments


Copy link

@rchl rchl commented Aug 16, 2020

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

$ go version
go1.14.5 darwin/amd64
gopls 0.4.4

Does this issue reproduce with the latest release?


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

go env Output
$ go env
(valid build configuration = false)
(build flags: [])

What did you do?

  1. Open a go file in VSCode
  2. Trigger Go: Restart Language Server from the command palette

What did you expect to see?

In the go server logs, there should be no:

gopls: failed reading header line: EOF


What did you see instead?

I see the aforementioned message in the logs and the server is exiting with exit code 2.

I think the relevant code is here:
And the problem might be that it's not doing what the comment there says. The comment says:

// read the header, stop on the first empty line

but since the'\n') call is looking for a newline, I think it will return non-nil err when it sees an empty line. Thus we'll never get to the graceful, empty-line handling lower in the code.

@gopherbot gopherbot added this to the Unreleased milestone Aug 16, 2020
@stamblerre stamblerre changed the title x/tools/gopls Returns with non-0 exit code on server restart / shutdown x/tools/gopls: returns with non-0 exit code on server restart / shutdown Aug 17, 2020
Copy link

@stamblerre stamblerre commented Aug 17, 2020

Thanks for the report! I haven't seen this issue before--are you able to consistently reproduce it when you restart the language server?

/cc @findleyr @ianthehat

@stamblerre stamblerre modified the milestones: Unreleased, gopls/v.0.5.0 Aug 17, 2020
Copy link

@rchl rchl commented Aug 17, 2020

Yes. I can consistently reproduce it.

Note that I'm not a VSCode user. I'm using Sublime Text where non-zero exit code returned from the server triggers a "crash dialog" so that's why I've noticed it.

But as I've said, I've also reproduced this with VSCode (at least the same stderr message as I can't see the exit code in vscode).

Copy link

@gopherbot gopherbot commented Aug 19, 2020

Change mentions this issue: internal/lsp/cmd: suppress EOF errors in serve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants