Closed
Description
gopls version: v0.13.2 (go1.21.0)
gopls flags:
update flags: proxy
extension version: 0.39.1
go version: 1.21.3
environment: Visual Studio Code darwin
initialization error: undefined
issue timestamp: Mon, 23 Oct 2023 12:40:27 GMT
restart history:
Mon, 23 Oct 2023 12:08:39 GMT: activation (enabled: true)
ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.
Describe what you observed.
panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x100ff9084] goroutine 897 [running]: golang.org/x/tools/gopls/internal/lsp/cache.localPackageKey({{0x140005245d0, 0x17}, {0x140005245d0, 0x17}, {0x140004e4ab0, 0x5}, {0x140003fe000, 0x1, 0x1}, {0x140003fe020, ...}, ...}) check.go:1402 0x554 golang.org/x/tools/gopls/internal/lsp/cache.(*packageHandleBuilder).buildPackageHandle(0x1400139a060, {0x10155dcc0, 0x140000e11d0}, 0x140000e0820) check.go:1090 0x234 golang.org/x/tools/gopls/internal/lsp/cache.(*snapshot).getPackageHandles.func2.1() check.go:891 0xb0 golang.org/x/sync/errgroup.(*Group).Go.func1() errgroup.go:75 0x58 created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1033 errgroup.go:72 0x98 [Error - 14:40:21]
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.
<OPTIONAL: ATTACH LOGS HERE>
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
gopherbot commentedon Oct 23, 2023
Change https://go.dev/cl/537075 mentions this issue:
go/packages: avoid classic any((*T)(nil)) != nil pitfall with Sizes
adonovan commentedon Oct 23, 2023
There are a number of overlapping things here but the primary cause is missing error checks when converting from go list output to types.Sizes (and the logic has changed but there are different errors in both the old and the new logic).
The crash can be readily reproduced (in v0.13.2 and on master) by giving a bad GOARCH:
Fix (for tip) pending. I don't intend to fix v0.13.2.
adonovan commentedon Oct 23, 2023
Closing as a duplicate of #63701 in gopls, for which a fix is pending.
findleyr commentedon Oct 26, 2023
Hi, can you please report if you are using a
GOPACKAGESDRIVER
? (echo $GOPACKAGESDRIVER
)?gopherbot commentedon Oct 26, 2023
Change https://go.dev/cl/537875 mentions this issue:
go/internal/packagesdriver: be defensive wrt error results
opsanatoliy commentedon Oct 26, 2023
I am not
gopherbot commentedon Oct 26, 2023
Change https://go.dev/cl/537876 mentions this issue:
go/packages: don't fail if GOPACKAGESDRIVER leaves Compiler/GOARCH=""
go/internal/packagesdriver: be defensive wrt error results
go/packages: don't fail if GOPACKAGESDRIVER leaves Compiler/GOARCH=""
gopherbot commentedon Oct 26, 2023
Change https://go.dev/cl/537877 mentions this issue:
go/packages: don't fail if GOPACKAGESDRIVER leaves Compiler/GOARCH=""
[gopls-release-branch.0.14] go/packages: don't fail if GOPACKAGESDRIV…
findleyr commentedon Oct 26, 2023
This should be fixed in v0.14.1-pre.1 (on v0.14.0 there is a workspace error message instead of a panic).
Could anyone here please try that out to confirm? With your confirmation, we will release v0.14.1 tomorrow.
bcspragu commentedon Dec 21, 2023
I just ran into this on
v0.14.2
, and I am usingGOPACKAGESDRIVER
:Cleaned up from my editor (Helix):
Invoking editor something like:
And
scripts/gopackagesdriver.sh
has:adonovan commentedon Dec 28, 2023
Hi @bcspragu, the filename in that stack trace shows gopls@v0.13.2, so I suspect you are not running the executable you intended to, and the source at that line corresponds to the bug that was fixed, as mentioned above.
Please try reinstalling gopls@latest, and check the version of the gopls command on the $PATH. Do let us know if the problem recurs after that.
bcspragu commentedon Dec 28, 2023
Oof yeah apologies for the noise, looks like I just forgot to reload my shell to pick up my
$PATH
changes, which would have preferred the local0.14.2
binary over the older system-wide one I had.