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

vscode crashes with vscode-go extension enabled and editing a go file #2229

Closed
frezbo opened this issue May 6, 2022 · 9 comments
Closed

Comments

@frezbo
Copy link

frezbo commented May 6, 2022

What version of Go, VS Code & VS Code Go extension are you using?

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.
❯ go version
go version go1.18.1 linux/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
❯ gopls version
golang.org/x/tools/gopls v0.8.3
    golang.org/x/tools/[email protected] h1:Mxm94ix8oSARQ6svioO6SxKEYWT/VCP54/448LOHzrk=
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
❯ code --version
1.67.0
57fd6d0195bb9b9d1b49f6da5db789060795de47
x64
  • Check your installed extensions to get the version of the VS Code Go extension
Name: Go
Id: golang.go
Description: Rich Go language support for Visual Studio Code
Version: 0.33.0
Publisher: Go Team at Google
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=golang.Go
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
Checking configured tools....
GOBIN: undefined
toolsGopath: 
gopath: /home/frezbo/work/golang
GOROOT: /home/frezbo/.local/share/aquaproj-aqua/pkgs/http/golang.org/dl/go1.18.1.linux-amd64.tar.gz/go
PATH: /home/frezbo/.local/share/aquaproj-aqua/bin:/home/frezbo/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/frezbo/work/golang/bin:/home/frezbo/.local/bin/node/bin

	go:	/home/frezbo/.local/share/aquaproj-aqua/bin/go: go version go1.18.1 linux/amd64

	gotests:	/home/frezbo/work/golang/bin/gotests	(version: v1.6.0 built with go: go1.18.1)
	gomodifytags:	/home/frezbo/work/golang/bin/gomodifytags	(version: v1.16.0 built with go: go1.18.1)
	impl:	/home/frezbo/work/golang/bin/impl	(version: v1.1.0 built with go: go1.18.1)
	goplay:	/home/frezbo/work/golang/bin/goplay	(version: v1.0.0 built with go: go1.18.1)
	dlv:	/home/frezbo/work/golang/bin/dlv	(version: v1.8.3 built with go: go1.18.1)
	staticcheck:	/home/frezbo/work/golang/bin/staticcheck	(version: v0.3.1 built with go: go1.18.1)
	gopls:	/home/frezbo/work/golang/bin/gopls	(version: v0.8.3 built with go: go1.18.1)

go env
Workspace Folder (extensions): /home/frezbo/work/siderolabs/extensions
	GO111MODULE=""
	GOARCH="amd64"
	GOBIN=""
	GOCACHE="/home/frezbo/.cache/go-build"
	GOENV="/home/frezbo/.config/go/env"
	GOEXE=""
	GOEXPERIMENT=""
	GOFLAGS=""
	GOHOSTARCH="amd64"
	GOHOSTOS="linux"
	GOINSECURE=""
	GOMODCACHE="/home/frezbo/work/golang/pkg/mod"
	GONOPROXY=""
	GONOSUMDB=""
	GOOS="linux"
	GOPATH="/home/frezbo/work/golang"
	GOPRIVATE=""
	GOPROXY="https://proxy.golang.org,direct"
	GOROOT="/home/frezbo/.local/share/aquaproj-aqua/pkgs/http/golang.org/dl/go1.18.1.linux-amd64.tar.gz/go"
	GOSUMDB="sum.golang.org"
	GOTMPDIR=""
	GOTOOLDIR="/home/frezbo/.local/share/aquaproj-aqua/pkgs/http/golang.org/dl/go1.18.1.linux-amd64.tar.gz/go/pkg/tool/linux_amd64"
	GOVCS=""
	GOVERSION="go1.18.1"
	GCCGO="gccgo"
	GOAMD64="v1"
	AR="ar"
	CC="gcc"
	CXX="g++"
	CGO_ENABLED="1"
	GOMOD="/dev/null"
	GOWORK=""
	CGO_CFLAGS="-g -O2"
	CGO_CPPFLAGS=""
	CGO_CXXFLAGS="-g -O2"
	CGO_FFLAGS="-g -O2"
	CGO_LDFLAGS="-g -O2"
	PKG_CONFIG="pkg-config"
	GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1692870286=/tmp/go-build -gno-record-gcc-switches"

Steps to reproduce the behavior:

  • Open a go project in vscode
  • Try saving the go file with a change, vscode exits/crashes

Disabling the go-extension and cannot reproduce.

ref: microsoft/vscode#148922

@gopherbot gopherbot added this to the Untriaged milestone May 6, 2022
@hyangah
Copy link
Contributor

hyangah commented May 6, 2022

Is there any repro case or log? I am afraid there isn't much without a repro case or crash log.

@frezbo
Copy link
Author

frezbo commented May 6, 2022

is there some docs on how to get the crash log?

@hyangah
Copy link
Contributor

hyangah commented May 6, 2022

Not sure if there is anything but you can try

"Developer: Open Log Folder" command -- that is the directory where the current window's logs sit.
You will need to go above the directory and find the logs from the crashed session.
I don't know which logs would be interesting for debugging - 'exthost*/exthost.log' and "gopls (server).log" in its output_logging directory may be interesting.

@frezbo
Copy link
Author

frezbo commented May 6, 2022

This is from a new project and just ran go mod init debug

[Info  - 12:24:16 AM] 2022/05/07 00:24:16 go/packages.Load
	snapshot=0
	directory=/tmp/tmp.6wrY6EkiiN
	query=[builtin debug/...]
	packages=23

[Error - 12:24:16 AM] 2022/05/07 00:24:16 tidy: diagnosing file:///tmp/tmp.6wrY6EkiiN/go.mod: err: exit status 1: stderr: debug: no Go source files


[Error - 12:24:17 AM] 2022/05/07 00:24:17 tidy: diagnosing file:///tmp/tmp.6wrY6EkiiN/go.mod: err: exit status 1: stderr: debug: no Go source files


[Error - 12:24:18 AM] 2022/05/07 00:24:18 DocumentSymbols failed: getting file for DocumentSymbols: no packages for non-Go file file:///tmp/tmp.6wrY6EkiiN/go.mod (go.mod)
	URI=file:///tmp/tmp.6wrY6EkiiN/go.mod

[Info  - 12:25:46 AM] 2022/05/07 00:25:46 go/packages.Load
	snapshot=3
	package="command-line-arguments"
	files=[/tmp/tmp.6wrY6EkiiN/main.go]

[Info  - 12:25:46 AM] 2022/05/07 00:25:46 go/packages.Load
	snapshot=3
	directory=/tmp/tmp.6wrY6EkiiN
	query=[file=/tmp/tmp.6wrY6EkiiN/main.go]
	packages=1

[Info  - 12:25:46 AM] 2022/05/07 00:25:46 go/packages.Load
	snapshot=3
	directory=/tmp/tmp.6wrY6EkiiN
	query=[file=/tmp/tmp.6wrY6EkiiN/main.go]
	packages=1

[Info  - 12:25:46 AM] 2022/05/07 00:25:46 go/packages.Load
	snapshot=3
	package="command-line-arguments"
	files=[/tmp/tmp.6wrY6EkiiN/main.go]

[Error - 12:25:46 AM] 2022/05/07 00:25:46 tidy: diagnosing file:///tmp/tmp.6wrY6EkiiN/go.mod: err: exit status 1: stderr: debug: no Go source files

@frezbo
Copy link
Author

frezbo commented May 6, 2022

From an existing project

I see this too:

[Info  - 12:27:18 AM] 2022/05/07 00:27:18 go/packages.Load
	snapshot=0
	directory=/home/frezbo/work/siderolabs/extensions/examples/hello-world-service/src
	query=[builtin github.com/siderolabs/hello-world/...]
	packages=2

[Info  - 12:27:18 AM] 2022/05/07 00:27:18 falling back to safe trimming due to type errors: [/home/frezbo/.local/share/aquaproj-aqua/pkgs/http/golang.org/dl/go1.18.1.linux-amd64.tar.gz/go/src/runtime/vdso_linux.go:53:38: invalid operation: division by zero /home/frezbo/.local/share/aquaproj-aqua/pkgs/http/golang.org/dl/go1.18.1.linux-amd64.tar.gz/go/src/runtime/vdso_linux.go:54:38: invalid operation: division by zero] or still-missing identifiers: map[memRecordCycle:true pageBits:true]
	package="runtime"

[Info  - 12:27:18 AM] 2022/05/07 00:27:18 discovered missing identifiers: map[options:true]
	package="vendor/golang.org/x/text/unicode/bidi"

@frezbo
Copy link
Author

frezbo commented May 10, 2022

it seems the issue is caused when go is executed by a wrapper as mentioned in aquaproj/aqua#710

https://github.com/aquaproj/aqua-proxy/blob/bb56ec820a8a0a0caac98563993de705465c672e/pkg/cli/proxy.go#L30=

@frezbo
Copy link
Author

frezbo commented May 10, 2022

Closing this since it's been fixed in the aqua package manager, apologies for the noise.

@frezbo frezbo closed this as completed May 10, 2022
@hyangah
Copy link
Contributor

hyangah commented May 10, 2022

@frezbo Thanks for sharing and fixing the issue. I am not familiar with Aqua. Do you mind telling us more about how the mentioned bug could bring down the entire vscode? (parents of the gopls)?

@frezbo
Copy link
Author

frezbo commented May 11, 2022

@hyangah so aqua is a sort of like a package registry which allows to install binary assets. So what aqua does is create a symlink for go to aqua-proxy which then executed the go command from the actual download path as a child process. So when vscode starts gopls it seems to be running as a child of aqua-proxy which crashes the whole thing

 which go
/home/frezbo/.local/share/aquaproj-aqua/bin/go
❯ ls -l /home/frezbo/.local/share/aquaproj-aqua/bin/go
lrwxrwxrwx 10 frezbo  2 May 12:05 /home/frezbo/.local/share/aquaproj-aqua/bin/go -> aqua-proxy

aqua-proxy forks into the go binary located at below path

❯ ls -l /home/frezbo/.local/share/aquaproj-aqua/pkgs/http/golang.org/dl/go1.18.2.linux-amd64.tar.gz/go/
drwxr-xr-x    - frezbo 11 May 02:00 api
.rw-r--r--  56k frezbo 11 May 02:00 AUTHORS
drwxr-xr-x    - frezbo 11 May 02:00 bin
.rw-r--r--   52 frezbo 11 May 02:00 codereview.cfg
.rw-r--r-- 1.3k frezbo 11 May 02:00 CONTRIBUTING.md
.rw-r--r-- 111k frezbo 11 May 02:00 CONTRIBUTORS
drwxr-xr-x    - frezbo 11 May 02:00 doc
drwxr-xr-x    - frezbo 11 May 02:00 lib
.rw-r--r-- 1.5k frezbo 11 May 02:00 LICENSE
drwxr-xr-x    - frezbo 11 May 02:00 misc
.rw-r--r-- 1.3k frezbo 11 May 02:00 PATENTS
drwxr-xr-x    - frezbo 11 May 02:00 pkg
.rw-r--r-- 1.5k frezbo 11 May 02:00 README.md
.rw-r--r--  397 frezbo 11 May 02:00 SECURITY.md
drwxr-xr-x    - frezbo 11 May 02:00 src
drwxr-xr-x    - frezbo 11 May 02:00 test
.rw-r--r--    8 frezbo 11 May 02:00 VERSION
~ 

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants