golang / vscode-go

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

gopls: automated issue report (crash) #3354

Closed LeDuyViet closed 4 months ago

LeDuyViet commented 5 months ago

gopls version: v0.15.3/go1.22.1 gopls flags: update flags: proxy extension version: 0.41.2 environment: Visual Studio Code win32 initialization error: undefined issue timestamp: Sat, 20 Apr 2024 13:43:30 GMT restart history: Sat, 20 Apr 2024 13:07:40 GMT: activation (enabled: true) Sat, 20 Apr 2024 13:09:27 GMT: installation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

Please attach the stack trace from the crash. A window with the error message should have popped up in the lower half of your screen. Please copy the stack trace and error messages from that window and paste it in this issue. Failed to auto-collect gopls trace: no gopls log.
gopls stats -anon { "DirStats": { "Files": 2792, "TestdataFiles": 0, "GoFiles": 385, "ModFiles": 1, "Dirs": 435 }, "GOARCH": "amd64", "GOOS": "windows", "GOPACKAGESDRIVER": "", "GOPLSCACHE": "", "GoVersion": "go1.22.1", "GoplsVersion": "v0.15.3", "InitialWorkspaceLoadDuration": "7.832918s", "MemStats": { "HeapAlloc": 139608808, "HeapInUse": 226271232, "TotalAlloc": 1894755288 }, "WorkspaceStats": { "Files": { "Total": 8882, "Largest": 1755733, "Errs": 0 }, "Views": [ { "GoCommandVersion": "go1.22.1", "AllPackages": { "Packages": 1850, "LargestPackage": 1578, "CompiledGoFiles": 8983, "Modules": 142 }, "WorkspacePackages": { "Packages": 142, "LargestPackage": 30, "CompiledGoFiles": 483, "Modules": 1 }, "Diagnostics": 19 } ] } }
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.
hyangah commented 5 months ago

Thanks for the report @LeDuyViet Do you still experience the crash? If so, can you please share the log you see in the gopls output channel and tell us when you observed this popup (e.g. I was updating gopls, I just opened the vscode, I did refactoring, ...)? Screen Shot 2021-01-27 at 2 53 49 PM

LeDuyViet commented 5 months ago

Yes, it is output

[Error - 1:10:47 PM] Request textDocument/typeDefinition failed.
  Message: no type definition for throw
  Code: 0 
[Error - 1:10:48 PM] Request textDocument/typeDefinition failed.
  Message: no type definition for fatal
  Code: 0 
[Error - 1:10:48 PM] Request textDocument/typeDefinition failed.
  Message: no type definition for fatal
  Code: 0 
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0xfad61c]

goroutine 583544 [running]:
go/token.(*File).Name(...)
    C:/Users/Admin/sdk/go1.22.2/src/go/token/position.go:109
golang.org/x/tools/gopls/internal/golang.mapPosition({0x16b8368, 0xc051a29200}, 0x0?, {0x16b0060, 0xc048606a20}, 0x0, 0x7)
    D:/Workspace/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/golang/definition.go:301 +0x5c
golang.org/x/tools/gopls/internal/golang.OutgoingCalls({0x16b8368?, 0xc051a290e0?}, 0xc048606a20, {0x16bad80, 0xc00b4ca4e0}, {0x12d?, 0x0?})
    D:/Workspace/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/golang/call_hierarchy.go:282 +0xb32
golang.org/x/tools/gopls/internal/server.(*server).OutgoingCalls(0xc000222100, {0x16b83a0?, 0xc043792410?}, 0xc048dc06e0)
    D:/Workspace/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/server/call_hierarchy.go:58 +0x195
golang.org/x/tools/gopls/internal/protocol.serverDispatch({0x16b83a0, 0xc043792410}, {0x16d3120, 0xc000222100}, 0xc051a29020, {0x16b8560, 0xc0408ddd00})
    D:/Workspace/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/protocol/tsserver.go:131 +0x4daa
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3({0x16b83a0, 0xc043792410}, 0xc051a29020, {0x16b8560, 0xc0408ddd00})
    D:/Workspace/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/protocol/protocol.go:160 +0x85
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4({0x16b83a0, 0xc043792410}, 0xc051a29020, {0x16b8560, 0xc0408ddd00})
    D:/Workspace/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/lsprpc/lsprpc.go:509 +0x923
golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1({0x16b83a0, 0xc043792410}, 0xc0437a80d8, {0x16b8560, 0xc0408ddd00})
    D:/Workspace/go/pkg/mod/golang.org/x/tools@v0.18.1-0.20240412183611-d92ae0781217/internal/jsonrpc2/handler.go:35 +0xc6
golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2()
    D:/Workspace/go/pkg/mod/golang.org/x/tools@v0.18.1-0.20240412183611-d92ae0781217/internal/jsonrpc2/handler.go:103 +0x96
created by golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2 in goroutine 58
    D:/Workspace/go/pkg/mod/golang.org/x/tools@v0.18.1-0.20240412183611-d92ae0781217/internal/jsonrpc2/handler.go:100 +0x1c5
[Error - 1:10:49 PM] 
LeDuyViet commented 5 months ago
goroutine 2306143 [running]:
go/token.(*File).Name(...)
    C:/Users/Admin/sdk/go1.22.2/src/go/token/position.go:109
golang.org/x/tools/gopls/internal/golang.mapPosition({0x16b8368, 0xc04408b3b0}, 0x0?, {0x16b0060, 0xc00926c120}, 0x0, 0x7)
    D:/Workspace/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/golang/definition.go:301 +0x5c
golang.org/x/tools/gopls/internal/golang.OutgoingCalls({0x16b8368?, 0xc04408b290?}, 0xc00926c120, {0x16bad80, 0xc009986f00}, {0x12c?, 0x0?})
    D:/Workspace/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/golang/call_hierarchy.go:282 +0xb32
golang.org/x/tools/gopls/internal/server.(*server).OutgoingCalls(0xc00038a200, {0x16b83a0?, 0xc002e2f090?}, 0xc041cce3c0)
    D:/Workspace/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/server/call_hierarchy.go:58 +0x195
golang.org/x/tools/gopls/internal/protocol.serverDispatch({0x16b83a0, 0xc002e2f090}, {0x16d3120, 0xc00038a200}, 0xc04408b1d0, {0x16b8560, 0xc0482393c0})
    D:/Workspace/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/protocol/tsserver.go:131 +0x4daa
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3({0x16b83a0, 0xc002e2f090}, 0xc04408b1d0, {0x16b8560, 0xc0482393c0})
    D:/Workspace/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/protocol/protocol.go:160 +0x85
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4({0x16b83a0, 0xc002e2f090}, 0xc04408b1d0, {0x16b8560, 0xc0482393c0})
    D:/Workspace/go/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/lsprpc/lsprpc.go:509 +0x923
golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1({0x16b83a0, 0xc002e2f090}, 0xc03a9d2a38, {0x16b8560, 0xc0482393c0})
    D:/Workspace/go/pkg/mod/golang.org/x/tools@v0.18.1-0.20240412183611-d92ae0781217/internal/jsonrpc2/handler.go:35 +0xc6
golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2()
    D:/Workspace/go/pkg/mod/golang.org/x/tools@v0.18.1-0.20240412183611-d92ae0781217/internal/jsonrpc2/handler.go:103 +0x96
created by golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2 in goroutine 115
    D:/Workspace/go/pkg/mod/golang.org/x/tools@v0.18.1-0.20240412183611-d92ae0781217/internal/jsonrpc2/handler.go:100 +0x1c5
[Error - 3:33:05 PM] 
[Error - 3:33:05 PM] Request textDocument/typeDefinition failed.
  Message: write EPIPE
  Code: -32099 
[Error - 3:33:05 PM] Request textDocument/typeDefinition failed.
  Message: Cannot call write after a stream was destroyed
  Code: -32099 
[Error - 3:33:05 PM] Request workspace/symbol failed.
  Message: Cannot call write after a stream was destroyed
  Code: -32099 
[Error - 3:33:05 PM] Connection to server got closed. Server will not be restarted.
[Error - 3:33:05 PM] Stopping server failed
  Message: Cannot call write after a stream was destroyed
  Code: -32099 
[Error - 3:33:05 PM] Stopping server failed
  Message: Cannot call write after a stream was destroyed
  Code: -32099 
hyangah commented 4 months ago

Thank you so much @LeDuyViet for sharing the trace. This is a dup of golang/go#66923 (crash during call hierarchy)

Let's follow up there.