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/internal/lsp: segfault in atomicalign.run #30154

Closed
pwaller opened this issue Feb 10, 2019 · 1 comment
Closed

x/tools/internal/lsp: segfault in atomicalign.run #30154

pwaller opened this issue Feb 10, 2019 · 1 comment

Comments

@pwaller
Copy link
Contributor

pwaller commented Feb 10, 2019

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

$ go version
go version devel +4b3f04c63b Thu Jan 10 18:15:48 2019 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes, I am testing on master (3744606) at time of writing.

What did you do?

Compile gopls with -race. Use cmd/gopls/forward. Use vscode-go. I am working out of my $GOPATH using modules, and have GO111MODULE=on.

Open my editor to start working on a project.

What did you expect to see?

Things working as normal.

What did you see instead?

gopls crashes shortly after the editor is opened.

Additional notes

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x80740b]

goroutine 10 [running]:
golang.org/x/tools/go/analysis/passes/atomicalign.run(0xc003e52090, 0xc0088aa070, 0xdd83a0, 0xc004b82048, 0x0)
	/home/pwaller/.local/src/golang.org/x/tools/go/analysis/passes/atomicalign/atomicalign.go:30 +0x5b
golang.org/x/tools/internal/lsp/source.runAnalyses.func2.1()
	/home/pwaller/.local/src/golang.org/x/tools/internal/lsp/source/diagnostics.go:285 +0xaa4
sync.(*Once).Do(0xc006c71630, 0xc000477768)
	/home/pwaller/.local/src/go/src/sync/once.go:44 +0xdf
golang.org/x/tools/internal/lsp/source.runAnalyses.func2(0xdd7d80, 0x0)
	/home/pwaller/.local/src/golang.org/x/tools/internal/lsp/source/diagnostics.go:246 +0x10e
golang.org/x/tools/internal/lsp/source.runAnalyses.func3.1(0xc009479b10, 0xc009437650, 0xdd7d80)
	/home/pwaller/.local/src/golang.org/x/tools/internal/lsp/source/diagnostics.go:294 +0x4f
created by golang.org/x/tools/internal/lsp/source.runAnalyses.func3
	/home/pwaller/.local/src/golang.org/x/tools/internal/lsp/source/diagnostics.go:293 +0x100

I added some instrumentation to identify the nil pointer:

	log.Printf("pass = %p", pass)
	log.Printf("pass.TypesSizes = %p", pass.TypesSizes)
	log.Printf("types.Typ = %p", types.Typ)
2019/02/10 14:24:21 pass = 0xc0000acc60
2019/02/10 14:24:21 pass.TypesSizes = %!p(<nil>)
2019/02/10 14:24:21 types.Typ = 0xdd8a00

/cc @stamblerre

@stamblerre
Copy link
Contributor

stamblerre commented Feb 11, 2019

Fixed in https://golang.org/cl/161937. Thanks for reporting!

@golang golang locked and limited conversation to collaborators Feb 11, 2020
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