golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.79k stars 729 forks source link

gopls: automated issue report (crash) #3198

Closed joeslazaro closed 4 months ago

joeslazaro commented 4 months ago

gopls version: v0.15.0/go1.22.0 gopls flags: update flags: proxy extension version: 0.41.1 environment: Visual Studio Code darwin initialization error: undefined issue timestamp: Wed, 28 Feb 2024 06:07:04 GMT restart history: Wed, 28 Feb 2024 04:34:40 GMT: activation (enabled: true) Wed, 28 Feb 2024 05:55:40 GMT: manual (enabled: true) Wed, 28 Feb 2024 05:59:00 GMT: manual (enabled: true) Wed, 28 Feb 2024 06:04:53 GMT: manual (enabled: true) Wed, 28 Feb 2024 06:06:03 GMT: manual (enabled: true) Wed, 28 Feb 2024 06:06:13 GMT: manual (enabled: true)

DESCRIPTION

I had a file open with a new function I'm trying to write. The line I was working on was return zaptest and the word "zaptest" was underlined in red with a message in VSCode saying that it is an undefined symbol. I added a period after it and then pressed CTRL+Space to trigger intellisense, which didn't have anything helpful. I then pressed escape and that is what triggered the crash. It is 100% reproducible.

STACK TRACE:

[Error - 11:07:00 PM] Request textDocument/semanticTokens/full failed. Message: semantictokens are disabled Code: 0 panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x100e90bc4]

goroutine 12603 [running]: golang.org/x/tools/gopls/internal/golang.highlightFuncControlFlow({0x14004bfc480, 0x6, 0xe?}, 0x14002b10a80) /Users/joe/.local/share/go/pkg/mod/golang.org/x/tools/gopls@v0.15.0/internal/golang/highlight.go:241 +0x354 golang.org/x/tools/gopls/internal/golang.highlightPath({0x14004bfc480, 0x6, 0x8}, 0x14002f84780, 0x140045b4720) /Users/joe/.local/share/go/pkg/mod/golang.org/x/tools/gopls@v0.15.0/internal/golang/highlight.go:102 +0x298 golang.org/x/tools/gopls/internal/golang.Highlight({0x101550648?, 0x14002b10660?}, 0x14003f7fe60, {0x101551920, 0x14003dc55c0}, {0x4f56400?, 0x140?}) /Users/joe/.local/share/go/pkg/mod/golang.org/x/tools/gopls@v0.15.0/internal/golang/highlight.go:53 +0x230 golang.org/x/tools/gopls/internal/server.(server).DocumentHighlight(0x140006b8000, {0x101550680, 0x140026560f0}, 0x14002b10300) /Users/joe/.local/share/go/pkg/mod/golang.org/x/tools/gopls@v0.15.0/internal/server/highlight.go:32 +0x198 golang.org/x/tools/gopls/internal/protocol.serverDispatch({0x101550680, 0x140026560f0}, {0x101569b80, 0x140006b8000}, 0x14002b102d0, {0x101550840, 0x14004f46f80}) /Users/joe/.local/share/go/pkg/mod/golang.org/x/tools/gopls@v0.15.0/internal/protocol/tsserver.go:376 +0x4dd0 golang.org/x/tools/gopls/internal/lsprpc.(streamServer).ServeStream.ServerHandler.func3({0x101550680, 0x140026560f0}, 0x14002b102d0, {0x101550840, 0x14004f46f80}) /Users/joe/.local/share/go/pkg/mod/golang.org/x/tools/gopls@v0.15.0/internal/protocol/protocol.go:160 +0x74 golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4({0x101550680, 0x140026560f0}, 0x14002b102d0, {0x101550840, 0x14004f46f80}) /Users/joe/.local/share/go/pkg/mod/golang.org/x/tools/gopls@v0.15.0/internal/lsprpc/lsprpc.go:509 +0x6e0 golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1({0x101550680, 0x140026560f0}, 0x14003d10300, {0x101550840, 0x14004f46f80}) /Users/joe/.local/share/go/pkg/mod/golang.org/x/tools@v0.18.1-0.20240221145400-a220b3b5ba60/internal/jsonrpc2/handler.go:35 +0xc0 golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2() /Users/joe/.local/share/go/pkg/mod/golang.org/x/tools@v0.18.1-0.20240221145400-a220b3b5ba60/internal/jsonrpc2/handler.go:103 +0x90 created by golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2 in goroutine 132 /Users/joe/.local/share/go/pkg/mod/golang.org/x/tools@v0.18.1-0.20240221145400-a220b3b5ba60/internal/jsonrpc2/handler.go:100 +0x19c [Error - 11:07:04 PM]

Failed to auto-collect gopls trace: no gopls log.

DETAILS

<details><summary>gopls stats -anon</summary>
{
  "DirStats": {
    "Files": 2084,
    "TestdataFiles": 2,
    "GoFiles": 37,
    "ModFiles": 1,
    "Dirs": 338
  },
  "GOARCH": "arm64",
  "GOOS": "darwin",
  "GOPACKAGESDRIVER": "",
  "GOPLSCACHE": "",
  "GoVersion": "go1.22.0",
  "GoplsVersion": "v0.15.0",
  "InitialWorkspaceLoadDuration": "1.546743083s",
  "MemStats": {
    "HeapAlloc": 27561304,
    "HeapInUse": 39673856,
    "TotalAlloc": 71337672
  },
  "WorkspaceStats": {
    "Files": {
      "Total": 2108,
      "Largest": 395026,
      "Errs": 0
    },
    "Views": [
      {
        "GoCommandVersion": "go1.22.0",
        "AllPackages": {
          "Packages": 355,
          "LargestPackage": 155,
          "CompiledGoFiles": 2104,
          "Modules": 70
        },
        "WorkspacePackages": {
          "Packages": 20,
          "LargestPackage": 4,
          "CompiledGoFiles": 35,
          "Modules": 1
        },
        "Diagnostics": 1
      }
    ]
  }
}
</details>
joeslazaro commented 4 months ago

I enabled the rpc.trace flag and captured the attached log.

crash-trace.json

findleyr commented 4 months ago

Thanks. This is a dupe of #3194, which is fixed in the prerelease that will be released today:

go install golang.org/x/tools/gopls@v0.15.1-pre.1