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

gopls: connection to server is erroring.Shuting down server. #3027

Open
pengkou opened this issue Oct 30, 2023 · 14 comments
Open

gopls: connection to server is erroring.Shuting down server. #3027

pengkou opened this issue Oct 30, 2023 · 14 comments
Labels
automatedReport Automatically created issues WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@pengkou
Copy link

pengkou commented Oct 30, 2023

Type: Bug

[Error - 6:12:17 PM] Client gopls: connection to server is erroring. Shutting down server.
[Error - 6:12:17 PM] Stopping server failed
Error: Client is not running and can't be stopped. It's current state is: starting
at GoLanguageClient.shutdown (/root/.vscode-server/extensions/golang.go-0.39.1/dist/goMain.js:15406:17)
at GoLanguageClient.stop (/root/.vscode-server/extensions/golang.go-0.39.1/dist/goMain.js:15383:21)
at GoLanguageClient.stop (/root/.vscode-server/extensions/golang.go-0.39.1/dist/goMain.js:17843:22)
at GoLanguageClient.handleConnectionError (/root/.vscode-server/extensions/golang.go-0.39.1/dist/goMain.js:15624:16)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Extension version: 0.39.1
VS Code version: Code 1.83.1 (f1b07bd25dfad64b0167beb15359ae573aecd2cc, 2023-10-10T23:46:55.789Z)
OS version: Darwin x64 22.6.0
Modes:
Remote OS version: Linux x64 3.10.107-1-tlinux2_kvm_guest-0049

System Info
Item Value
CPUs Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 2, 2, 2
Memory (System) 16.00GB (0.20GB free)
Process Argv --crash-reporter-id 7749a106-8b6f-46b8-ab3e-47b8cb87cc62
Screen Reader no
VM 0%
Item Value
Remote SSH: 9.134.163.170
OS Linux x64 3.10.107-1-tlinux2_kvm_guest-0049
CPUs AMD EPYC 7K62 48-Core Processor (8 x 2595)
Memory (System) 15.42GB (14.44GB free)
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263:30856252
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
2e4cg342:30602488
f6dab269:30613381
showlangstatbar:30737416
962ge761:30841074
03d35959:30757346
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
pythonnosmt12:30797651
pythonidxpt:30866567
pythonnoceb:30805159
copilotsettingt:30859503
synctok:30869157
dsvsc013:30795093
dsvsc014:30804076
dsvsc015:30845448
pythontestfixtcf:30871695
pythonregdiag2:30871582
pyreplss1:30865275
pythoncet0:30874138
2e7ec940:30870395
pythontbext0:30864172

@gopherbot gopherbot added this to the Untriaged milestone Oct 30, 2023
@findleyr
Copy link
Member

Hi, thanks for the report. Could you please share the output of gopls version?

Can you please also share the log you see in the gopls output channel and tell us when you observed this popup (e.g. I was updating gopls, I just opened the vscode, I did refactoring, ...)?
Screen Shot 2021-01-27 at 2 53 49 PM

@findleyr findleyr added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Oct 30, 2023
@hyangah hyangah added the automatedReport Automatically created issues label Oct 30, 2023
@pengkou
Copy link
Author

pengkou commented Nov 1, 2023

企业微信截图_00ecdf14-2b19-46bb-bf15-8a8ac491e9ca

I observed this popup when I just opened the vscode.

@pengkou
Copy link
Author

pengkou commented Nov 1, 2023

it works well before, this issue occurs just from the Monday of this weak.

@findleyr
Copy link
Member

findleyr commented Nov 1, 2023

Can you please share the output of gopls version?

@pengkou
Copy link
Author

pengkou commented Nov 2, 2023

golang.org/x/tools/gopls v0.14.1
golang.org/x/tools/[email protected] h1:XaTETpi7Q67XO8nftquJitcx+9c2bPclO8Kz2sBVvec=

@hyangah
Copy link
Contributor

hyangah commented Nov 2, 2023

Thanks @jiangxiaPeter Are you still experiencing the issue?

  • Can you please share the log entries before what's shown in your screenshot? Connection to server was erroring, and we need to learn what that is.

  • output of gopls -v version. (sorry -v was missing)

@pengkou
Copy link
Author

pengkou commented Nov 2, 2023

Can you please share the log entries before what's shown in your screenshot? Connection to server was erroring, and we need to learn what that is.

log entries in the screenshot is all that in the gopls output channel.

output of gopls -v version. (sorry -v was missing)

Build info

golang.org/x/tools/gopls v0.14.1
golang.org/x/tools/[email protected] h1:XaTETpi7Q67XO8nftquJitcx+9c2bPclO8Kz2sBVvec=
github.com/google/[email protected] h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/sergi/[email protected] h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
golang.org/x/[email protected] h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
golang.org/x/[email protected] h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
golang.org/x/[email protected] h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/[email protected] h1:1baVNneD/IRxmu8JQdBuki78zUqBtZxq8smZXQj0X2Y=
golang.org/x/[email protected] h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/[email protected] h1:5YgdZAe2w0x3Xrjv0+GXrI0jvm7qCQK/ySGFfiEHMfU=
golang.org/x/[email protected] h1:KUas02EjQK5LTuIx1OylBQdKKZ9jeugs+HiqO5HormU=
mvdan.cc/[email protected] h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=
mvdan.cc/xurls/[email protected] h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
go: go1.18

@pengkou
Copy link
Author

pengkou commented Nov 2, 2023

The issue continues to exist now

@hyangah
Copy link
Contributor

hyangah commented Nov 2, 2023

Thanks.

The error logs seem to indicate the LSP client couldn't establish connection at all.
(this confusing error message - trying to stop a server that fails to start... - is under discussion microsoft/vscode-languageserver-node#1307)

I think a couple of possibilities:

  • Try if rolling back to gopls v0.13.2 helps. (gopls v0.14.x was released recently)
  • Try gopls daemon mode setup - if gopls process crashes for some reason, that may be visible from the terminal where the daemon mode gopls runs.

Daemon mode setup
From a terminal, start the daemon on port 37374.

gopls -listen=:37374 -logfile=auto -debug=:0 -vv

The following VS Code setting will make the extension starts gopls in client mode.

 "go.languageServerFlags": ["-remote=:37374", "-logfile=auto", "-rpc.trace"]

See if the daemon receives connection, or crashes.

We've also seen cases where remote host environment is a problem (e.g. #2986 even though this specific case seems to cause to crash the entire extension host :-(). So, would be also helpful to check if the same vscode/vscode-go/gopls/go causes the same issue on local dev setup.

@pengkou
Copy link
Author

pengkou commented Nov 3, 2023

Try if rolling back to gopls v0.13.2 helps

I am trying by go get command go get golang.org/x/tools/[email protected], but it remains v0.14.1.

Try gopls daemon mode setup - if gopls process crashes for some reason, that may be visible from the terminal where the daemon mode gopls runs.

root     17598  0.0  0.1 1144640 16220 pts/6   Sl+  09:34   0:00 gopls -listen=:37374 -logfile=auto -debug=:0 -vv
root     19420  0.1  0.0 1153092 13712 ?       Sl   09:36   0:00 /root/go/bin/gopls -mode=stdio -remote=:37374 -logfile=auto -rpc.trace

Nothing seems wrong, log entries on the terminal is:

gopls -listen=:37374 -logfile=auto -debug=:0 -vv
serve.go:443: debug server listening at http://localhost:46563
serve.go:132: Gopls daemon: listening on tcp network, address :37374...

lsprpc.go:106: Session 1: connected
lsprpc.go:484: Session 1: got handshake. Logfile: "/tmp/gopls-19420.log", Debug addr: ""

gopls-19420.log

So, would be also helpful to check if the same vscode/vscode-go/gopls/go causes the same issue on local dev setup.

It works well on my local mac machine with gopls v0.14.1

@hyangah
Copy link
Contributor

hyangah commented Nov 3, 2023

To install gopls v0.13.2 use go install golang.org/x/tools/[email protected]. (not go get). And restart window.

But, given that the client gopls (process 19420) claims it sent messages to the LSP client (vscode), I am more leaning towards the culprit is not in gopls.

If you enable the client side logging "go.trace.server": "verbose", you will be able to see more logging on the client-side output channel (name 'gopls'). Are there any trace of messages (initialize response) in the channel?

Before reaching out to the vscode team for help, you may try a couple of other things

@pengkou
Copy link
Author

pengkou commented Nov 6, 2023

No more log found after client side logging enabled.

Restarting the remote vscode server and Restarting the remote machine does not work too.

@pengkou
Copy link
Author

pengkou commented Nov 6, 2023

There will be some cost for me to migrate the remote machine, I will try later.

@jwbda
Copy link

jwbda commented Jul 26, 2024

Same problem, anything new?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automatedReport Automatically created issues WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants