Skip to content

x/tools/gopls: crash in debug.GetInstance during go generate #53781

Closed
@iboware

Description

@iboware

gopls version: v0.9.0 (go1.18.3)
gopls flags:
update flags: proxy
extension version: 0.34.1
go version: 1.18.3
environment: Visual Studio Code linux
initialization error: undefined
issue timestamp: Fri, 08 Jul 2022 13:08:32 GMT
restart history:
Fri, 08 Jul 2022 12:30:55 GMT: activation (enabled: true)
Fri, 08 Jul 2022 12:33:55 GMT: manual (enabled: true)
Fri, 08 Jul 2022 12:41:02 GMT: installation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

I was trying to generate mocks by gomock. it become unresponsive and then crashed.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x5fcd13]

goroutine 3629 [running]:
golang.org/x/tools/internal/xcontext.detachedContext.Value(...)
	  xcontext.go:23
golang.org/x/tools/internal/lsp/debug.GetInstance({0x1073d48%3F, 0xc0048489b0%3F})
	  serve.go:361  0x3e
golang.org/x/tools/internal/lsp/debug.makeGlobalExporter.func1({0x1073d48, 0xc0048489b0}, {{0xc0aa28f2297931d3, 0x13facda29, 0x158cae0}, {{{0x1072a78, 0xc000032120}, 0xa, {0xcc75c0, 0xdffb9b}}, ...}, ...}, ...)
	  serve.go:571  0x7e
golang.org/x/tools/internal/event/core.deliver({0x1073d48, 0xc0048489b0}, 0xc0002edbc0, {{0xc0aa28f2297931d3, 0x13facda29, 0x158cae0}, {{{0x1072a78, 0xc000032120}, 0xa, {0xcc75c0, ...}}, ...}, ...})
	  export.go:45  0xfd
golang.org/x/tools/internal/event/core.ExportPair({_, _}, {{0x0, 0x0, 0x0}, {{{0x1072a78, 0xc000032120}, 0xa, {0xcc75c0, 0xdffb9b}}, ...}, ...}, ...)
	  export.go:68  0x128
golang.org/x/tools/internal/event.Start({0x1073d48%3F, 0xc0048489b0%3F}, {0xdffb9b%3F, 0xc00870cde0%3F}, {0xc0085c3db0%3F, 0x0%3F, 0x0%3F})
	  event.go:91  0x358
golang.org/x/tools/internal/jsonrpc2.(*conn).Notify(0x0%3F, {0x1073d48, 0xc0048489b0}, {0xdffb9b, 0xa}, {0xca9de0%3F, 0xc00870cde0%3F})
	  conn.go:85  0x35b
golang.org/x/tools/internal/lsp/protocol.clientConn.Notify(...)
	  protocol.go:60
golang.org/x/tools/internal/lsp/protocol.(*clientDispatcher).Progress(0xd8a9a0%3F, {0x1073d48%3F, 0xc0048489b0%3F}, 0x7fe5f4067a68%3F)
	  tsclient.go:168  0x42
golang.org/x/tools/internal/lsp/progress.(*WorkDone).Report(0xc009af7d10, {0x0%3F, 0x0%3F}, {0xc00670f440, 0x25}, 0x0)
	  progress.go:188  0x27e
golang.org/x/tools/internal/lsp/progress.(*WorkDoneWriter).Write(0xc00870c560%3F, {0xc0011c2000%3F, 0x25, 0x44e7f2%3F})
	  progress.go:268  0x5c
io.(*multiWriter).Write(0xc004fe2348%3F, {0xc0011c2000, 0x25, 0x8000})
	  multi.go:60  0x86
io.copyBuffer({0x106d200, 0xc007157dd0}, {0x106d6e0, 0xc004fe2348}, {0x0, 0x0, 0x0})
	  io.go:428  0x204
io.Copy(...)
	  io.go:385
os/exec.(*Cmd).writerDescriptor.func1()
	  exec.go:311  0x3a
os/exec.(*Cmd).Start.func1(0x0%3F)
	  exec.go:444  0x25
created by os/exec.(*Cmd).Start
	  exec.go:443  0x795
[Error - 3:08:24 PM] 

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>

Activity

changed the title [-]gopls: automated issue report (crash)[/-] [+]x/tools/gopls: crash in debug.GetInstance[/+] on Jul 11, 2022
findleyr

findleyr commented on Jul 11, 2022

@findleyr
Member

Thank you for the report. Is this by any chance reproducible for you?

In any case, we can investigate this crashing stack.

changed the title [-]x/tools/gopls: crash in debug.GetInstance[/-] [+]x/tools/gopls: crash in debug.GetInstance during `go generate`[/+] on Jul 11, 2022
added
ToolsThis label describes issues relating to any tools in the x/tools repository.
goplsIssues related to the Go language server, gopls.
on Jul 11, 2022
added this to the Unreleased milestone on Jul 11, 2022
transferred this issue fromgolang/vscode-goon Jul 11, 2022
findleyr

findleyr commented on Jul 12, 2022

@findleyr
Member

Reproduced with TestGenerateProgress, which was unfortunately skipped due to #49901 😞

Bisected to https://go.dev/cl/409936.

gopherbot

gopherbot commented on Jul 12, 2022

@gopherbot
Contributor

Change https://go.dev/cl/417115 mentions this issue: internal/lsp/progress: actually close of Context in WorkDoneWriter

33 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @iboware@gopherbot@findleyr

        Issue actions

          x/tools/gopls: crash in debug.GetInstance during `go generate` · Issue #53781 · golang/go