-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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: crash in goPackagesErrorDiagnostics #66875
Comments
@ty3gx is this crash reliably reproducible? |
Yes, the crash consistently happened every time I tried to execute my program. After a few crashes, the crash persists even after restarting the language server. I also had a Ubuntu machine running the same version of go (1.22.2), and the crash did not happen on that machine. |
@ty3gx sorry to hear that. I'll send a patch to avoid this panic. This patch will also capture some debugging information to help us understand the problem. |
golang/vscode-go#3352 contains a reliable reproducer for this crash. |
Dup of #67360. |
gopls version: v0.15.3/go1.22.2
gopls flags:
update flags: proxy
extension version: 0.41.2
environment: Visual Studio Code darwin
initialization error: undefined
issue timestamp: Wed, 17 Apr 2024 18:47:48 GMT
restart history:
Wed, 17 Apr 2024 18:47:31 GMT: activation (enabled: true)
ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.
Describe what you observed.
I was working with a relatively complex code that loads Go source code packages and does some instrumentation on the AST before compiling the instrumented code. gopls crashes regularly during the operation but my program works okay. Please let me know what additional information is needed.
gopls stats -anon
gopls stats -anon failed after 1380 ms. Please check if gopls is killed by OS.OPTIONAL: If you would like to share more information, you can attach your complete gopls logs.
NOTE: THESE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR CODEBASE.
DO NOT SHARE LOGS IF YOU ARE WORKING IN A PRIVATE REPOSITORY.
[Info - 2:47:31 PM] 2024/04/17 14:47:31 go info for /Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go
(view type GoModView)
(root dir /Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go)
(go version go version go1.22.2 darwin/amd64)
(build flags: [])
(go env: {GOOS:darwin GOARCH:amd64 GOCACHE:/Users/yangtianchang/Library/Caches/go-build GOMODCACHE:/Users/yangtianchang/go/pkg/mod GOPATH:/Users/yangtianchang/go GOPRIVATE: GOFLAGS: GO111MODULE: GoVersion:22 GoVersionOutput:go version go1.22.2 darwin/amd64
GOWORK: GOPACKAGESDRIVER:})
(env overlay: map[])
[Info - 2:47:37 PM] 2024/04/17 14:47:37 go/packages.Load golang/vscode-go#1
snapshot=0
directory=file:///Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go
query=[/Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go/... builtin]
packages=442
[Info - 2:47:37 PM] 2024/04/17 14:47:37 go/packages.Load golang/vscode-go#1: updating metadata for 640 packages
panic: runtime error: slice bounds out of range [1433:1432]
goroutine 3914 [running]:
golang.org/x/tools/gopls/internal/protocol.(*Mapper).LineCol8Position(0xc008da1020, 0x25, 0x0)
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/protocol/mapper.go:151 +0x1a5
golang.org/x/tools/gopls/internal/cache.goPackagesErrorDiagnostics.func1({{0xc000e84270, 0x30}, {0xc000f02f40, 0x33}, 0x1}, 0x33?, {0xe782900, 0xc00068ac60}, {0xe78ad00, 0xc008c51360})
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/errors.go:58 +0x145
golang.org/x/tools/gopls/internal/cache.goPackagesErrorDiagnostics({0xe78ad00, 0xc008c51360}, {{0xc000e84270, 0x30}, {0xc000f02f40, 0x33}, 0x1}, 0xc001049300, {0xe782900, 0xc00068ac60})
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/errors.go:69 +0xf5
golang.org/x/tools/gopls/internal/cache.computeLoadDiagnostics({0xe78ad00, 0xc008c51360}, 0xc00068ac60, 0xc001049300)
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/load.go:541 +0x185
golang.org/x/tools/gopls/internal/cache.(*packageHandleBuilder).buildPackageHandle(0xc00061d060, {0xe78ad00, 0xc008c51360}, 0xc008c50b90)
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/check.go:1129 +0x2b7
golang.org/x/tools/gopls/internal/cache.(*Snapshot).getPackageHandles.func2.1()
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/check.go:932 +0xce
golang.org/x/sync/errgroup.(*Group).Go.func1()
/Users/yangtianchang/go/pkg/mod/golang.org/x/sync@v0.6.0/errgroup/errgroup.go:78 +0x56
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 3958
/Users/yangtianchang/go/pkg/mod/golang.org/x/sync@v0.6.0/errgroup/errgroup.go:75 +0x96
[Info - 2:47:37 PM]
true
[Info - 2:47:38 PM] 2024/04/17 14:47:38 go info for /Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go
(view type GoModView)
(root dir /Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go)
(go version go version go1.22.2 darwin/amd64)
(build flags: [])
(go env: {GOOS:darwin GOARCH:amd64 GOCACHE:/Users/yangtianchang/Library/Caches/go-build GOMODCACHE:/Users/yangtianchang/go/pkg/mod GOPATH:/Users/yangtianchang/go GOPRIVATE: GOFLAGS: GO111MODULE: GoVersion:22 GoVersionOutput:go version go1.22.2 darwin/amd64
GOWORK: GOPACKAGESDRIVER:})
(env overlay: map[])
[Info - 2:47:40 PM] 2024/04/17 14:47:40 go/packages.Load golang/vscode-go#1
snapshot=0
directory=file:///Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go
query=[/Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go/... builtin]
packages=442
[Info - 2:47:40 PM] 2024/04/17 14:47:40 go/packages.Load golang/vscode-go#1: updating metadata for 640 packages
[Error - 2:47:40 PM] Request textDocument/semanticTokens/full failed.
Message: semantictokens are disabled
Code: 0
panic: runtime error: slice bounds out of range [1433:1432]
goroutine 4346 [running]:
golang.org/x/tools/gopls/internal/protocol.(*Mapper).LineCol8Position(0xc00ab0cb40, 0x25, 0x0)
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/protocol/mapper.go:151 +0x1a5
golang.org/x/tools/gopls/internal/cache.goPackagesErrorDiagnostics.func1({{0xc000b20cf0, 0x30}, {0xc000ea6e80, 0x33}, 0x1}, 0x33?, {0xa765900, 0xc000f0c240}, {0xa76dd00, 0xc00aa6c320})
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/errors.go:58 +0x145
golang.org/x/tools/gopls/internal/cache.goPackagesErrorDiagnostics({0xa76dd00, 0xc00aa6c320}, {{0xc000b20cf0, 0x30}, {0xc000ea6e80, 0x33}, 0x1}, 0xc00101dd00, {0xa765900, 0xc000f0c240})
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/errors.go:69 +0xf5
golang.org/x/tools/gopls/internal/cache.computeLoadDiagnostics({0xa76dd00, 0xc00aa6c320}, 0xc000f0c240, 0xc00101dd00)
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/load.go:541 +0x185
golang.org/x/tools/gopls/internal/cache.(*packageHandleBuilder).buildPackageHandle(0xc00a384560, {0xa76dd00, 0xc00aa6c320}, 0xc00aa2e9b0)
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/check.go:1129 +0x2b7
golang.org/x/tools/gopls/internal/cache.(*Snapshot).getPackageHandles.func2.1()
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/check.go:932 +0xce
golang.org/x/sync/errgroup.(*Group).Go.func1()
/Users/yangtianchang/go/pkg/mod/golang.org/x/sync@v0.6.0/errgroup/errgroup.go:78 +0x56
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 3681
/Users/yangtianchang/go/pkg/mod/golang.org/x/sync@v0.6.0/errgroup/errgroup.go:75 +0x96
[Info - 2:47:41 PM]
true
[Info - 2:47:41 PM] 2024/04/17 14:47:41 go info for /Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go
(view type GoModView)
(root dir /Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go)
(go version go version go1.22.2 darwin/amd64)
(build flags: [])
(go env: {GOOS:darwin GOARCH:amd64 GOCACHE:/Users/yangtianchang/Library/Caches/go-build GOMODCACHE:/Users/yangtianchang/go/pkg/mod GOPATH:/Users/yangtianchang/go GOPRIVATE: GOFLAGS: GO111MODULE: GoVersion:22 GoVersionOutput:go version go1.22.2 darwin/amd64
GOWORK: GOPACKAGESDRIVER:})
(env overlay: map[])
[Info - 2:47:43 PM] 2024/04/17 14:47:43 go/packages.Load golang/vscode-go#1
snapshot=0
directory=file:///Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go
query=[/Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go/... builtin]
packages=442
[Info - 2:47:43 PM] 2024/04/17 14:47:43 go/packages.Load golang/vscode-go#1: updating metadata for 640 packages
panic: runtime error: slice bounds out of range [1433:1432]
goroutine 3486 [running]:
golang.org/x/tools/gopls/internal/protocol.(*Mapper).LineCol8Position(0xc008778900, 0x25, 0x0)
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/protocol/mapper.go:151 +0x1a5
golang.org/x/tools/gopls/internal/cache.goPackagesErrorDiagnostics.func1({{0xc0007398c0, 0x30}, {0xc000e3d840, 0x33}, 0x1}, 0x33?, {0x5839900, 0xc0004e6c60}, {0x5841d00, 0xc008f0d900})
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/errors.go:58 +0x145
golang.org/x/tools/gopls/internal/cache.goPackagesErrorDiagnostics({0x5841d00, 0xc008f0d900}, {{0xc0007398c0, 0x30}, {0xc000e3d840, 0x33}, 0x1}, 0xc001009600, {0x5839900, 0xc0004e6c60})
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/errors.go:69 +0xf5
golang.org/x/tools/gopls/internal/cache.computeLoadDiagnostics({0x5841d00, 0xc008f0d900}, 0xc0004e6c60, 0xc001009600)
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/load.go:541 +0x185
golang.org/x/tools/gopls/internal/cache.(*packageHandleBuilder).buildPackageHandle(0xc0079f32a0, {0x5841d00, 0xc008f0d900}, 0xc00865a410)
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/check.go:1129 +0x2b7
golang.org/x/tools/gopls/internal/cache.(*Snapshot).getPackageHandles.func2.1()
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/check.go:932 +0xce
golang.org/x/sync/errgroup.(*Group).Go.func1()
/Users/yangtianchang/go/pkg/mod/golang.org/x/sync@v0.6.0/errgroup/errgroup.go:78 +0x56
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 3502
/Users/yangtianchang/go/pkg/mod/golang.org/x/sync@v0.6.0/errgroup/errgroup.go:75 +0x96
[Info - 2:47:43 PM]
true
[Info - 2:47:43 PM] 2024/04/17 14:47:43 go info for /Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go
(view type GoModView)
(root dir /Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go)
(go version go version go1.22.2 darwin/amd64)
(build flags: [])
(go env: {GOOS:darwin GOARCH:amd64 GOCACHE:/Users/yangtianchang/Library/Caches/go-build GOMODCACHE:/Users/yangtianchang/go/pkg/mod GOPATH:/Users/yangtianchang/go GOPRIVATE: GOFLAGS: GO111MODULE: GoVersion:22 GoVersionOutput:go version go1.22.2 darwin/amd64
GOWORK: GOPACKAGESDRIVER:})
(env overlay: map[])
[Info - 2:47:44 PM] 2024/04/17 14:47:44 go/packages.Load golang/vscode-go#1
snapshot=0
directory=file:///Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go
query=[/Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go/... builtin]
packages=442
[Info - 2:47:44 PM] 2024/04/17 14:47:44 go/packages.Load golang/vscode-go#1: updating metadata for 640 packages
[Error - 2:47:45 PM] Request textDocument/semanticTokens/full failed.
Message: semantictokens are disabled
Code: 0
panic: runtime error: slice bounds out of range [1433:1432]
goroutine 3712 [running]:
golang.org/x/tools/gopls/internal/protocol.(*Mapper).LineCol8Position(0xc00a6f81e0, 0x25, 0x0)
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/protocol/mapper.go:151 +0x1a5
golang.org/x/tools/gopls/internal/cache.goPackagesErrorDiagnostics.func1({{0xc000a91350, 0x30}, {0xc000b62dc0, 0x33}, 0x1}, 0x33?, {0x7c42900, 0xc0005af8c0}, {0x7c4ad00, 0xc00a5b2640})
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/errors.go:58 +0x145
golang.org/x/tools/gopls/internal/cache.goPackagesErrorDiagnostics({0x7c4ad00, 0xc00a5b2640}, {{0xc000a91350, 0x30}, {0xc000b62dc0, 0x33}, 0x1}, 0xc000c4fa00, {0x7c42900, 0xc0005af8c0})
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/errors.go:69 +0xf5
golang.org/x/tools/gopls/internal/cache.computeLoadDiagnostics({0x7c4ad00, 0xc00a5b2640}, 0xc0005af8c0, 0xc000c4fa00)
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/load.go:541 +0x185
golang.org/x/tools/gopls/internal/cache.(*packageHandleBuilder).buildPackageHandle(0xc009dfbe00, {0x7c4ad00, 0xc00a5b2640}, 0xc00a4dbd10)
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/check.go:1129 +0x2b7
golang.org/x/tools/gopls/internal/cache.(*Snapshot).getPackageHandles.func2.1()
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/check.go:932 +0xce
golang.org/x/sync/errgroup.(*Group).Go.func1()
/Users/yangtianchang/go/pkg/mod/golang.org/x/sync@v0.6.0/errgroup/errgroup.go:78 +0x56
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 4336
/Users/yangtianchang/go/pkg/mod/golang.org/x/sync@v0.6.0/errgroup/errgroup.go:75 +0x96
[Info - 2:47:46 PM]
true
[Info - 2:47:46 PM] 2024/04/17 14:47:46 go info for /Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go
(view type GoModView)
(root dir /Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go)
(go version go version go1.22.2 darwin/amd64)
(build flags: [])
(go env: {GOOS:darwin GOARCH:amd64 GOCACHE:/Users/yangtianchang/Library/Caches/go-build GOMODCACHE:/Users/yangtianchang/go/pkg/mod GOPATH:/Users/yangtianchang/go GOPRIVATE: GOFLAGS: GO111MODULE: GoVersion:22 GoVersionOutput:go version go1.22.2 darwin/amd64
GOWORK: GOPACKAGESDRIVER:})
(env overlay: map[])
[Info - 2:47:47 PM] 2024/04/17 14:47:47 go/packages.Load golang/vscode-go#1
snapshot=0
directory=file:///Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go
query=[/Users/yangtianchang/Downloads/proj/daikon/daikon-assert-go/... builtin]
packages=442
[Info - 2:47:47 PM] 2024/04/17 14:47:47 go/packages.Load golang/vscode-go#1: updating metadata for 640 packages
[Error - 2:47:47 PM] Request textDocument/semanticTokens/full failed.
Message: semantictokens are disabled
Code: 0
panic: runtime error: slice bounds out of range [1433:1432]
goroutine 4338 [running]:
golang.org/x/tools/gopls/internal/protocol.(*Mapper).LineCol8Position(0xc00a4e0600, 0x25, 0x0)
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/protocol/mapper.go:151 +0x1a5
golang.org/x/tools/gopls/internal/cache.goPackagesErrorDiagnostics.func1({{0xc000aa5260, 0x30}, {0xc0004ccd40, 0x33}, 0x1}, 0x33?, {0xbd07900, 0xc000e7c5a0}, {0xbd0fd00, 0xc00a7b3950})
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/errors.go:58 +0x145
golang.org/x/tools/gopls/internal/cache.goPackagesErrorDiagnostics({0xbd0fd00, 0xc00a7b3950}, {{0xc000aa5260, 0x30}, {0xc0004ccd40, 0x33}, 0x1}, 0xc001057700, {0xbd07900, 0xc000e7c5a0})
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/errors.go:69 +0xf5
golang.org/x/tools/gopls/internal/cache.computeLoadDiagnostics({0xbd0fd00, 0xc00a7b3950}, 0xc000e7c5a0, 0xc001057700)
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/load.go:541 +0x185
golang.org/x/tools/gopls/internal/cache.(*packageHandleBuilder).buildPackageHandle(0xc00a742180, {0xbd0fd00, 0xc00a7b3950}, 0xc00a77e8c0)
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/check.go:1129 +0x2b7
golang.org/x/tools/gopls/internal/cache.(*Snapshot).getPackageHandles.func2.1()
/Users/yangtianchang/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/cache/check.go:932 +0xce
golang.org/x/sync/errgroup.(*Group).Go.func1()
/Users/yangtianchang/go/pkg/mod/golang.org/x/sync@v0.6.0/errgroup/errgroup.go:78 +0x56
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 4296
/Users/yangtianchang/go/pkg/mod/golang.org/x/sync@v0.6.0/errgroup/errgroup.go:75 +0x96
[Error - 2:47:48 PM]
The text was updated successfully, but these errors were encountered: