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: prevent multiple restart language server requests #1011

Closed
hyangah opened this issue Dec 7, 2020 · 1 comment
Closed

gopls: prevent multiple restart language server requests #1011

hyangah opened this issue Dec 7, 2020 · 1 comment
Assignees
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented Dec 7, 2020

From golang/go#43023.
The trace shows that multiple outstanding language server restart requests confuses subsequent language client start process.

[Trace - 20:53:24.387 PM] Sending request 'shutdown - (35)'.
Params: 

...
[Trace - 21:07:06.546 PM] Received response 'shutdown - (35)' in 822159ms.
Result: null

While the first shutdown request is blocked waiting for the gopls's response, extra restart requests were made.
As a result, as soon as the language server was restarted eventually, unblocked languageClient.stop calls are followed by dispose that race with subsequent start and mess with the restart sequence.
When the connection is set up dispose triggers shutdown requests. See multiple shutdown requests were sent to the language server back to back. (message id 1 and 2) immediately following the initialize request.

[Trace - 21:07:06.546 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2020/12/05 21:07:06 Shutdown session\n\tshutdown_session=1\n"}

[Error - 下午9:07:06] Starting client failed
Error: Connection is already listening
	at throwIfListening (c:\Users\xiaoqing\.vscode\extensions\golang.go-0.19.0\dist\goMain.js:94014:19)
	at Object.listen (c:\Users\xiaoqing\.vscode\extensions\golang.go-0.19.0\dist\goMain.js:94344:13)
	at Object.listen (c:\Users\xiaoqing\.vscode\extensions\golang.go-0.19.0\dist\goMain.js:10479:34)
	at c:\Users\xiaoqing\.vscode\extensions\golang.go-0.19.0\dist\goMain.js:12535:24
[Error - 下午9:07:06] Starting client failed
Error: Connection is already listening
	at throwIfListening (c:\Users\xiaoqing\.vscode\extensions\golang.go-0.19.0\dist\goMain.js:94014:19)
	at Object.listen (c:\Users\xiaoqing\.vscode\extensions\golang.go-0.19.0\dist\goMain.js:94344:13)
	at Object.listen (c:\Users\xiaoqing\.vscode\extensions\golang.go-0.19.0\dist\goMain.js:10479:34)
	at c:\Users\xiaoqing\.vscode\extensions\golang.go-0.19.0\dist\goMain.js:12535:24
[Trace - 21:07:06.706 PM] Sending request 'initialize - (0)'.
Params: {"processId":29660,"clientInfo": ... }

[Trace - 21:07:06.717 PM] Sending request 'shutdown - (1)'.
Params: 


[Trace - 21:07:06.717 PM] Sending request 'shutdown - (2)'.
Params: 


[Trace - 21:07:06.719 PM] Received response 'shutdown - (1)' in 1ms.
Result: null


[Trace - 21:07:06.719 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2020/12/05 21:07:06 server shutdown without initialization\n"}

[Trace - 21:07:06.719 PM] Received response 'shutdown - (2)' in 1ms.
Result: null

We need to prevent additional restart language server request while the previous language server restart request is still pending.

@hyangah hyangah added the NeedsFix The path to resolution is known, but the work has not been done. label Dec 7, 2020
@hyangah hyangah added this to Needs Triage in vscode-go: gopls by default via automation Dec 8, 2020
@hyangah hyangah self-assigned this Dec 9, 2020
@hyangah hyangah moved this from Needs Triage to Non-critical in vscode-go: gopls by default Dec 10, 2020
@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/276973 mentions this issue: src/goLanguageServer: show language server start progress

@hyangah hyangah moved this from Non-critical to In progress in vscode-go: gopls by default Dec 10, 2020
vscode-go: gopls by default automation moved this from In progress to Done Dec 11, 2020
@hyangah hyangah added this to the v0.20.0 milestone Dec 21, 2020
@golang golang locked and limited conversation to collaborators Dec 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
No open projects
Development

No branches or pull requests

2 participants