-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: panic in analysis #60551
Comments
Also, worth to mention, this panic (.Err on nil) happens a lot in console with different ways. |
In 0.11.0 version all was ok, and today I successfully returned 0.11.0 version - everything works fine. Something wrong with 12 version of gopls |
Thanks very much for the report. We'll fix this panic. CC @adonovan |
Change https://go.dev/cl/500055 mentions this issue: |
This change documents and asserts a few invariants that should be maintained by the code. The crash in golang/go#60551 shows that they are not, but I still can't see the mistake in my proof. Updates golang/go#60551 Change-Id: I833f7575f1d7372837ab5d7ba5988c94650ce07f Reviewed-on: https://go-review.googlesource.com/c/tools/+/500055 Auto-Submit: Alan Donovan <adonovan@google.com> Run-TryBot: Alan Donovan <adonovan@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
@KaurkerDevourer, would you mind installing the latest prerelease which contains additional assertions for this issue, and report whether the crashes you see have changed?
I don't expect the change to fix the bug, but it should give us more information. Thanks! |
Also, if you're able to reproduce this on an open-source project, please tell us, as that would make it much easier to diagnose and fix. Thanks. |
Hello. Sorry, just noticed updates on this issue. Actually, yes, now you got some more info =) panic: analyzeSummary.Actions["asmdecl"] = (nil, false); got map[ctrlflow:0xc0013ef6e0 printf:0xc0013ef740] (#60551) Sadly, project is not public. But above the error I can see Seems like now panic is expected. Every panic has the exact same - "asmdecl", ctrlflow, printf |
Thanks @KaurkerDevourer! I'm still looking into this, but it's worth knowing that we just made a significant reorganization of the analysis driver (primarily a performance optimization), and it looks like it touched many of the same elements that I think are likely responsible for the bug you reported here. So you might want to try building the very latest gopls@master and see if it makes any difference. (How often does the problem strike? How long would it take for you to notice whether today's change had any benefit?) |
The "conflicting names" log message is a separate issue; I've filed #60904. |
We (@findleyr and I) have still had no luck trying to come up with a hypothesis for the main issue here, and not for lack of trying: every piece of the old implementation looks sound. Unsatisfying though it is, we recommend that you try building from master (or using today's https://github.com/golang/tools/releases/tag/gopls%2Fv0.12.3-pre.1) and see if the problem persists. Please do let us know what you find. |
If this no longer occurs in gopls@v0.12.4, I think we should close. This logic has been largely rewritten. @KaurkerDevourer could you please |
Request textDocument/semanticTokens/full failed. goroutine 5245 [running]: |
This is very strange. There's clearly some confusion about the set of analyzers associated with a root node: the final loop of (*snapshot).Analyze expects the |
Still no idea what this is. Though the analysis logic has been significantly reworked, I'm not sure if this is fixed. Moving to v0.18.0. |
gopls version
Build info
golang.org/x/tools/gopls v0.12.0
golang.org/x/tools/gopls@v0.12.0 h1:O8KGdGuvu3YmAwim3KYmV2l20Cce5VMS74LayO2cDw8=
github.com/BurntSushi/toml@v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
github.com/google/go-cmp@v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
golang.org/x/exp@v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA=
golang.org/x/exp/typeparams@v0.0.0-20221212164502-fae10dda9338 h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=
golang.org/x/mod@v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=
golang.org/x/sync@v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI=
golang.org/x/sys@v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/text@v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
golang.org/x/tools@v0.9.2-0.20230524171317-188b785caf35 h1:B5e02cBXQWRAs5SloauCQ9RXMKeqz96eIBJ3W9Ofy+U=
golang.org/x/vuln@v0.0.0-20230110180137-6ad3e3d07815 h1:A9kONVi4+AnuOr1dopsibH6hLi1Huy54cbeJxnq4vmU=
honnef.co/go/tools@v0.4.2 h1:6qXr+R5w+ktL5UkwEbPp+fEvfyoMPche6GkOpGHZcLc=
mvdan.cc/gofumpt@v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=
mvdan.cc/xurls/v2@v2.4.0 h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
go: go1.19.2
go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/kaurkerdevourer/Library/Caches/go-build"
GOENV="/Users/kaurkerdevourer/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/kaurkerdevourer/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/kaurkerdevourer"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.19.2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/kaurkerdevourer/Desktop/git/repo/go.mod"
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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/gn/x8n96lv93171yc5pcv09r02w0000gn/T/go-build509356644=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
Tried to open VSCode
What did you expect to see?
Normal working VSCode
What did you see instead?
Nothing works, can't run tests, can't go to definition. In console I can see
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x58 pc=0x1007e49f1]
goroutine 111 [running]:
golang.org/x/tools/gopls/internal/lsp/cache.(*snapshot).Analyze(0xc0006a6000, {0x100d6a3c0, 0xc00045a870}, {0xc0004bec00, 0x3f}, {0xc001cdf000, 0xc9, 0x100819dc5?})
/Users/kaurkerdevourer/go/pkg/mod/golang.org/x/tools/gopls@v0.12.0/internal/lsp/cache/analysis.go:229 +0x491
golang.org/x/tools/gopls/internal/lsp/source.Analyze({0x100d6a3c0, 0xc00045a870}, {0x100d76cd8, 0xc0006a6000}, {0xc0004bec00, 0x3f}, 0x1)
/Users/kaurkerdevourer/go/pkg/mod/golang.org/x/tools/gopls@v0.12.0/internal/lsp/source/diagnostics.go:48 +0x264
golang.org/x/tools/gopls/internal/lsp.(*Server).codeAction(0x10095a8e0?, {0x100d6a318?, 0xc0001f2540?}, 0xc0002d6700)
/Users/kaurkerdevourer/go/pkg/mod/golang.org/x/tools/gopls@v0.12.0/internal/lsp/code_action.go:206 +0x16b8
golang.org/x/tools/gopls/internal/lsp.(*Server).CodeAction(0xc000346000?, {0x100d6a318?, 0xc0001f2540?}, 0x10095a8e0?)
/Users/kaurkerdevourer/go/pkg/mod/golang.org/x/tools/gopls@v0.12.0/internal/lsp/server_gen.go:16 +0x25
golang.org/x/tools/gopls/internal/lsp/protocol.serverDispatch({0x100d6a318, 0xc0001f2540}, {0x100d7a110, 0xc0001e64e0}, 0xc00045a330, {0x100d6a5f0, 0xc0001f2440})
/Users/kaurkerdevourer/go/pkg/mod/golang.org/x/tools/gopls@v0.12.0/internal/lsp/protocol/tsserver.go:237 +0x1f57
golang.org/x/tools/gopls/internal/lsp/protocol.ServerHandler.func1({0x100d6a318, 0xc0001f2540}, 0xc00045a330, {0x100d6a5f0, 0xc0001f2440})
/Users/kaurkerdevourer/go/pkg/mod/golang.org/x/tools/gopls@v0.12.0/internal/lsp/protocol/protocol.go:157 +0x90
golang.org/x/tools/gopls/internal/lsp/lsprpc.handshaker.func1({0x100d6a318, 0xc0001f2540}, 0xc00045a330, {0x100d6a5f0?, 0xc0001f2440?})
/Users/kaurkerdevourer/go/pkg/mod/golang.org/x/tools/gopls@v0.12.0/internal/lsp/lsprpc/lsprpc.go:519 +0xa39
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1({0x100d6a318, 0xc0001f2540}, 0xc000216e70, {0x100d6a5f0?, 0xc0001f2440?})
/Users/kaurkerdevourer/go/pkg/mod/golang.org/x/tools@v0.9.2-0.20230524171317-188b785caf35/internal/jsonrpc2/handler.go:35 +0xf6
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2()
/Users/kaurkerdevourer/go/pkg/mod/golang.org/x/tools@v0.9.2-0.20230524171317-188b785caf35/internal/jsonrpc2/handler.go:103 +0xa3
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
/Users/kaurkerdevourer/go/pkg/mod/golang.org/x/tools@v0.9.2-0.20230524171317-188b785caf35/internal/jsonrpc2/handler.go:100 +0x20a
Editor and settings
VSCODE
{
"security.workspace.trust.untrustedFiles": "open",
"files.autoSave": "afterDelay",
"editor.formatOnSave": false,
"[go]": {
"editor.formatOnSave": false
},
"[python]": {
"editor.formatOnType": true
},
"go.toolsManagement.autoUpdate": false,
"dev.containers.gitCredentialHelperConfigLocation": "none",
"dev.containers.copyGitConfig": false,
"cmake.configureOnOpen": true,
"cmake.buildDirectory": "/tmp/vscode-build",
"C_Cpp.intelliSenseEngine": "disabled",
"window.zoomLevel": -1,
"gopls": {
}
Logs
https://cs.opensource.google/go/x/tools/+/refs/tags/gopls/v0.12.0:gopls/internal/lsp/cache/analysis.go;l=228
"result" can be nil, so .Err will result in panic
The text was updated successfully, but these errors were encountered: