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: invalid error messages when switching between tags in kubernetes #43023

Open
wu0407 opened this issue Dec 5, 2020 · 2 comments
Open
Assignees
Labels
Milestone

Comments

@wu0407
Copy link

@wu0407 wu0407 commented Dec 5, 2020

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

$ go version
1.15.5
gopls :  0.5.5 
gopls flags: -rpc.trace



Does this issue reproduce with the latest release?

  1. open kubernets folder that code in the git tag 1.18.6, wait gopls server finished
  2. checkout to 1.19.0, that gopls server can not get functions document it fallback to use getdoc
  3. do "go: restart language server", it is not reponsed and retry again
  4. wait some moment, vscode go extension report The language server is not able to serve any features. Initialization failed: Error: Connection got disposed..

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

go env Output
$ go env
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\xiaoqing\AppData\Local\go-build
set GOENV=C:\Users\xiaoqing\AppData\Roaming\go\env  
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=D:\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=D:\go
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=D:\git\kubernetes\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\xiaoqing\AppData\Local\Temp\go-build065131578=/tmp/go-build -gno-record-gcc-switches

What did you do?

many go.exe process find in task manger

What did you expect to see?

checkout new branch should restart gopls server

What did you see instead?

gopls stop work and hover text not show anything after click "go: restart language server"
I can do reload windows to slove this problem
gopls server log
gopls-stop-work-on-checkout-new-branch.txt

vscode settings:
workspace

{
    //"go.buildTags": "linux",
    "go.toolsEnvVars": {
    "GOFLAGS": "-tags=linux -mod=mod"
    },
}

user

{
    "files.eol": "\n",
    "go.useCodeSnippetsOnFunctionSuggest": true,
    "editor.renderWhitespace": "all",
    "editor.renderControlCharacters": true,
    "files.autoSave": "afterDelay",
    "editor.wordWrap": "on",
    "go.toolsEnvVars": {
    
    //    "GOFLAGS": "-tags=linux"
    },
    "go.languageServerFlags": [
        "-rpc.trace",
    ],
    "go.languageServerExperimentalFeatures": {


        "diagnostics": true,
        "documentLink": true
    },
    "workbench.settings.openDefaultSettings": true,
    "editor.minimap.enabled": false,
    "go.formatTool": "goimports",
    "go.useLanguageServer": true,
}
@gopherbot gopherbot added this to the Unreleased milestone Dec 5, 2020
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Dec 7, 2020

I am not able to reproduce this issue, though I do see invalid error messages when switching between tags.

/cc @hyangah - is there possibly a bug here that the Go extension seems to crash when the language server is restarted manually after it has crashed?

@stamblerre stamblerre changed the title x/tools/gopls: stop work when git checkout diffrence tag/branch x/tools/gopls: invalid error messages when switching between tags in kubernetes Dec 7, 2020
@stamblerre stamblerre modified the milestones: Unreleased, gopls/vscode-go Dec 7, 2020
@stamblerre stamblerre added this to Needs Triage in vscode-go: gopls by default via automation Dec 7, 2020
@hyangah
Copy link
Contributor

@hyangah hyangah commented Dec 7, 2020

I see:

  1. gopls is hung here and even the shutdown response isn't answered in a timely manner.
[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
...

  1. when finally gopls responds to the shutdown request, the extension is trying to reestablish the connection, but it looks like the connection isn't cleaned up normally (gopls process is still up?), and the language client library fails to restart.
[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

I will ask the language client library devs about the second issue - why the cleanup isn't complete. We can retry to restart with a completely clean language client. But if it indicates the previous hung gopls is left behind, that's not ideal either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
vscode-go: gopls by default
  
To Investigate
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.