Skip to content
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 go/types.(*Checker).recordTypeAndValue #45002

Open
twocs opened this issue Mar 14, 2021 · 5 comments
Open

x/tools/gopls: crash in go/types.(*Checker).recordTypeAndValue #45002

twocs opened this issue Mar 14, 2021 · 5 comments

Comments

@twocs
Copy link

@twocs twocs commented Mar 14, 2021

gopls version: v0.6.6
gopls flags: -rpc.trace
extension version: 0.23.2
environment: Visual Studio Code win32
initialization error: undefined
manual restart count: 5
total start count: 6

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

gopls is trying to read all the files in the .history folder that some other extension has saved there.

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.

[Trace - 02:54:06.403 AM] Received response 'textDocument/hover - (691)' in 1ms.
Result: null


unexpected fault address 0xffffffffffffffff
fatal error: fault
[signal 0xc0000005 code=0x0 addr=0xffffffffffffffff pc=0xac3659]

goroutine 278107 [running]:
runtime.throw(0x14858a1, 0x5)
	C:/Program Files/Go/src/runtime/panic.go:1117 +0x79 fp=0xc19ac35f00 sp=0xc19ac35ed0 pc=0xafbed9
runtime.sigpanic()
	C:/Program Files/Go/src/runtime/signal_windows.go:245 +0x2d6 fp=0xc19ac35f58 sp=0xc19ac35f00 pc=0xb11e16
runtime.interhash(0xc7058effa8, 0xda9bf5fa, 0xc7058f0060)
	C:/Program Files/Go/src/runtime/alg.go:102 +0x39 fp=0xc19ac35fa0 sp=0xc19ac35f58 pc=0xac3659
runtime.evacuate(0x1389f00, 0xc191a5b890, 0x176dee)
	C:/Program Files/Go/src/runtime/map.go:1180 +0x3e2 fp=0xc19ac36058 sp=0xc19ac35fa0 pc=0xad22e2
runtime.growWork(0x1389f00, 0xc191a5b890, 0x27dba6)
	C:/Program Files/Go/src/runtime/map.go:1120 +0x9b fp=0xc19ac36080 sp=0xc19ac36058 pc=0xad1edb
runtime.mapassign(0x1389f00, 0xc191a5b890, 0xc19ac36120, 0xc19ac36140)
	C:/Program Files/Go/src/runtime/map.go:600 +0x514 fp=0xc19ac36100 sp=0xc19ac36080 pc=0xad0c34
go/types.(*Checker).recordTypeAndValue(0xc1d8810000, 0x15d7f20, 0xc0ab499220, 0xc0ab499207, 0x15cc678, 0xc1aaab50a0, 0x0, 0x0)
	C:/Program Files/Go/src/go/types/check.go:332 +0x165 fp=0xc19ac36168 sp=0xc19ac36100 pc=0xc61945
go/types.(*Checker).rawExpr(0xc1d8810000, 0xc17dcb4240, 0x15d7f20, 0xc0ab499220, 0x0, 0x0, 0x0)
	C:/Program Files/Go/src/go/types/expr.go:1053 +0x2c9 fp=0xc19ac36208 sp=0xc19ac36168 pc=0xc6ff49
go/types.(*Checker).multiExpr(0xc1d8810000, 0xc17dcb4240, 0x15d7f20, 0xc0ab499220)
	C:/Program Files/Go/src/go/types/expr.go:1652 +0x5f fp=0xc19ac36270 sp=0xc19ac36208 pc=0xc7473f
go/types.(*Checker).call.func1(0xc17dcb4240, 0x1)
	C:/Program Files/Go/src/go/types/call.go:73 +0x68 fp=0xc19ac362a0 sp=0xc19ac36270 pc=0xc98528
go/types.(*Checker).arguments(0xc1d8810000, 0xc17dcb4240, 0xc0ab497540, 0xc01710ff20, 0xc19ac36450, 0x2)
	C:/Program Files/Go/src/go/types/call.go:253 +0x152 fp=0xc19ac36380 sp=0xc19ac362a0 pc=0xc5e492
go/types.(*Checker).call(0xc1d8810000, 0xc17dcb4240, 0xc0ab497540, 0xca141047e8)
	C:/Program Files/Go/src/go/types/call.go:75 +0x6be fp=0xc19ac36478 sp=0xc19ac36380 pc=0xc5d9be
go/types.(*Checker).exprInternal(0xc1d8810000, 0xc17dcb4240, 0x15d7800, 0xc0ab497540, 0x0, 0x0, 0x2b811b10a28)
	C:/Program Files/Go/src/go/types/expr.go:1519 +0x1e2c fp=0xc19ac36ad8 sp=0xc19ac36478 pc=0xc71e2c
go/types.(*Checker).rawExpr(0xc1d8810000, 0xc17dcb4240, 0x15d7800, 0xc0ab497540, 0x0, 0x0, 0xc07931ec50)
	C:/Program Files/Go/src/go/types/expr.go:1029 +0x88 fp=0xc19ac36b78 sp=0xc19ac36ad8 pc=0xc6fd08
go/types.(*Checker).stmt(0xc1d8810000, 0x0, 0x15d79b0, 0xc07931ecc0)
	C:/Program Files/Go/src/go/types/stmt.go:331 +0x48b8 fp=0xc19ac376b0 sp=0xc19ac36b78 pc=0xc8d878
go/types.(*Checker).stmtList(0xc1d8810000, 0x0, 0xc083acdc00, 0x15, 0x20)
	C:/Program Files/Go/src/go/types/stmt.go:120 +0xe6 fp=0xc19ac376f8 sp=0xc19ac376b0 pc=0xc87826
go/types.(*Checker).funcBody(0xc1d8810000, 0xc0fa9ba0c0, 0xc0aae90d40, 0x36, 0xc26be2ad50, 0xc0ab489ad0, 0x0, 0x0)
	C:/Program Files/Go/src/go/types/stmt.go:42 +0x1f3 fp=0xc19ac37880 sp=0xc19ac376f8 pc=0xc87153
go/types.(*Checker).funcDecl.func1()
	C:/Program Files/Go/src/go/types/decl.go:749 +0x6e fp=0xc19ac378d0 sp=0xc19ac37880 pc=0xc98aae
go/types.(*Checker).processDelayed(0xc1d8810000, 0x0)
	C:/Program Files/Go/src/go/types/check.go:291 +0x45 fp=0xc19ac378f8 sp=0xc19ac378d0 pc=0xc61545
go/types.(*Checker).checkFiles(0xc1d8810000, 0xc0eb622000, 0x1791, 0x1791, 0x0, 0x0)
	C:/Program Files/Go/src/go/types/check.go:267 +0xdc fp=0xc19ac37948 sp=0xc19ac378f8 pc=0xc6143c
go/types.(*Checker).Files(...)
	C:/Program Files/Go/src/go/types/check.go:250
golang.org/x/tools/internal/lsp/cache.typeCheck(0x15d9498, 0xc1413b0140, 0xc0d60d4d00, 0xc0e47940e0, 0x2, 0xc24be51800, 0x0, 0x0, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cache/check.go:436 +0x12b3 fp=0xc19ac37e40 sp=0xc19ac37948 pc=0x11ccb93
golang.org/x/tools/internal/lsp/cache.(*snapshot).buildPackageHandle.func1(0x15d9498, 0xc1413b0140, 0x15c8420, 0xc0d60d4d00, 0xc0e6fba000, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cache/check.go:102 +0x1d8 fp=0xc19ac37f28 sp=0xc19ac37e40 pc=0x120c3f8
golang.org/x/tools/internal/memoize.(*Handle).run.func1(0xc56861a850, 0x15d9498, 0xc1413b0140, 0xc10e6eed60, 0x15c8420, 0xc0d60d4d00, 0xc0cb7763c0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/memoize/memoize.go:322 +0xb2 fp=0xc19ac37fa8 sp=0xc19ac37f28 pc=0x11c49f2
runtime.goexit()
	C:/Program Files/Go/src/runtime/asm_amd64.s:1371 +0x1 fp=0xc19ac37fb0 sp=0xc19ac37fa8 pc=0xb346a1
created by golang.org/x/tools/internal/memoize.(*Handle).run
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/memoize/memoize.go:315 +0x18d

goroutine 1 [chan receive, 6 minutes]:
golang.org/x/tools/internal/lsp/lsprpc.(*StreamServer).ServeStream(0xc00049a1a0, 0x15d9540, 0xc0004972f0, 0x15ddd78, 0xc0001ed220, 0x0, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/lsprpc/lsprpc.go:89 +0x345
golang.org/x/tools/internal/lsp/cmd.(*Serve).Run(0xc00049c030, 0x15d9540, 0xc000497350, 0xc000080070, 0x0, 0x1, 0x0, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cmd/serve.go:110 +0x70c
golang.org/x/tools/internal/tool.Run(0x15d9540, 0xc000497350, 0x15dd0b8, 0xc00049c030, 0xc000080070, 0x0, 0x1, 0x0, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/tool/tool.go:152 +0x316
golang.org/x/tools/internal/lsp/cmd.(*Application).Run(0xc00049c000, 0x15d94d0, 0xc00003a040, 0xc000080070, 0x0, 0x1, 0x0, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cmd/cmd.go:147 +0x354
golang.org/x/tools/internal/tool.Run(0x15d94d0, 0xc00003a040, 0x15dd078, 0xc00049c000, 0xc000080050, 0x2, 0x3, 0x0, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/tool/tool.go:152 +0x316
golang.org/x/tools/internal/tool.Main(0x15d94d0, 0xc00003a040, 0x15dd078, 0xc00049c000, 0xc000080050, 0x2, 0x3)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/tool/tool.go:91 +0x191
main.main()
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools/gopls@v0.6.6/main.go:25 +0xe5

goroutine 92 [syscall, locked to thread]:
syscall.Syscall6(0x7ff8079a4ee0, 0x5, 0xbac, 0xc0004a0000, 0x1000, 0xc0002a1db4, 0x0, 0x0, 0x0, 0x0, ...)
	C:/Program Files/Go/src/runtime/syscall_windows.go:343 +0xf2
syscall.ReadFile(0xbac, 0xc0004a0000, 0x1000, 0x1000, 0xc0002a1db4, 0x0, 0x7ffff800000, 0x2)
	C:/Program Files/Go/src/syscall/zsyscall_windows.go:1006 +0x105
syscall.Read(0xbac, 0xc0004a0000, 0x1000, 0x1000, 0xc0002a1f54, 0x2, 0x2)
	C:/Program Files/Go/src/syscall/syscall_windows.go:369 +0x6f
internal/poll.(*FD).Read(0xc0000b2000, 0xc0004a0000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	C:/Program Files/Go/src/internal/poll/fd_windows.go:427 +0x225
os.(*File).read(...)
	C:/Program Files/Go/src/os/file_posix.go:31
os.(*File).Read(0xc000006010, 0xc0004a0000, 0x1000, 0x1000, 0x2, 0x2, 0xc0002a1eb8)
	C:/Program Files/Go/src/os/file.go:117 +0x85
golang.org/x/tools/internal/fakenet.(*connFeeder).run(0xc0004973e0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/fakenet/conn.go:121 +0x102
created by golang.org/x/tools/internal/fakenet.NewConn
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/fakenet/conn.go:26 +0x2f9

goroutine 114 [select]:
golang.org/x/tools/internal/fakenet.(*connFeeder).do(0xc0004973e0, 0xc0004a0000, 0x1000, 0x1000, 0x0, 0x15d8280, 0xc000074440)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/fakenet/conn.go:103 +0x1a5
golang.org/x/tools/internal/fakenet.(*fakeConn).Read(0xc00049e400, 0xc0004a0000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/fakenet/conn.go:67 +0x54
bufio.(*Reader).fill(0xc000493620)
	C:/Program Files/Go/src/bufio/bufio.go:101 +0x10d
bufio.(*Reader).ReadSlice(0xc000493620, 0xa, 0x0, 0x0, 0x0, 0x0, 0x0)
	C:/Program Files/Go/src/bufio/bufio.go:360 +0x45
bufio.(*Reader).collectFragments(0xc000493620, 0xa, 0x13570e0, 0x1487fb3, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb07155, ...)
	C:/Program Files/Go/src/bufio/bufio.go:435 +0x85
bufio.(*Reader).ReadString(0xc000493620, 0xa, 0xc32f5cfc00, 0xd1459e, 0x15d9498, 0xc153daa0c0)
	C:/Program Files/Go/src/bufio/bufio.go:483 +0x53
golang.org/x/tools/internal/jsonrpc2.(*headerStream).Read(0xc0000052a8, 0x15d9540, 0xc0004972f0, 0x15d9690, 0xc153daa040, 0x0, 0x0, 0x1)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/jsonrpc2/stream.go:110 +0x9a
golang.org/x/tools/internal/lsp/protocol.(*loggingStream).Read(0xc000497440, 0x15d9540, 0xc0004972f0, 0x15d9690, 0xc153daa040, 0x0, 0x0, 0x15d9540)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/protocol/log.go:30 +0x58
golang.org/x/tools/internal/jsonrpc2.(*conn).run(0xc0001ed220, 0x15d9540, 0xc0004972f0, 0xc000004120)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/jsonrpc2/conn.go:196 +0xaf
created by golang.org/x/tools/internal/jsonrpc2.(*conn).Go
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/jsonrpc2/conn.go:189 +0x65

goroutine 93 [select]:
golang.org/x/tools/internal/fakenet.(*connFeeder).run(0xc000497410)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/fakenet/conn.go:115 +0xb4
created by golang.org/x/tools/internal/fakenet.NewConn
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/fakenet/conn.go:27 +0x31f

goroutine 91 [chan receive]:
golang.org/x/tools/internal/lsp/debug.(*Instance).MonitorMemory.func1(0xc0001ed180, 0xc00003ba50, 0xc0000f6300, 0x15d9540, 0xc000497350)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/debug/serve.go:458 +0x85
created by golang.org/x/tools/internal/lsp/debug.(*Instance).MonitorMemory
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/debug/serve.go:456 +0xa5

goroutine 15797 [semacquire, 6 minutes]:
sync.runtime_Semacquire(0xc0155f21d8)
	C:/Program Files/Go/src/runtime/sema.go:56 +0x49
sync.(*WaitGroup).Wait(0xc0155f21d0)
	C:/Program Files/Go/src/sync/waitgroup.go:130 +0x6b
golang.org/x/tools/internal/memoize.(*Generation).Destroy(0xc0155f21b0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/memoize/memoize.go:74 +0x5d
created by golang.org/x/tools/internal/lsp/cache.(*View).invalidateContent
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cache/view.go:627 +0x1ef

goroutine 317425 [runnable]:
go/types.(*Checker).initVars(0xc7ade3a120, 0xc209df1f48, 0x1, 0x1, 0xc0b5784ba0, 0x1, 0x1, 0x0)
	C:/Program Files/Go/src/go/types/assignments.go:224 +0x6b5
go/types.(*Checker).shortVarDecl(0xc7ade3a120, 0x15c9320, 0xc0ed4afa58, 0xc0b5784b80, 0x1, 0x1, 0xc0b5784ba0, 0x1, 0x1)
	C:/Program Files/Go/src/go/types/assignments.go:339 +0x29e
go/types.(*Checker).stmt(0xc7ade3a120, 0x0, 0x15d7680, 0xc04068e880)
	C:/Program Files/Go/src/go/types/stmt.go:408 +0x3d25
go/types.(*Checker).simpleStmt(0xc7ade3a120, 0x15d7680, 0xc04068e880)
	C:/Program Files/Go/src/go/types/stmt.go:98 +0x5e
go/types.(*Checker).stmt(0xc7ade3a120, 0x0, 0x15d7b30, 0xc04068eb80)
	C:/Program Files/Go/src/go/types/stmt.go:501 +0x4ad8
go/types.(*Checker).stmtList(0xc7ade3a120, 0x0, 0xc0b5804c00, 0x1d, 0x20)
	C:/Program Files/Go/src/go/types/stmt.go:120 +0xe6
go/types.(*Checker).funcBody(0xc7ade3a120, 0xc281d20de0, 0xc0b580f6c8, 0x13, 0xc1df6b55c0, 0xc04068d350, 0x0, 0x0)
	C:/Program Files/Go/src/go/types/stmt.go:42 +0x1f3
go/types.(*Checker).funcDecl.func1()
	C:/Program Files/Go/src/go/types/decl.go:749 +0x6e
go/types.(*Checker).processDelayed(0xc7ade3a120, 0x0)
	C:/Program Files/Go/src/go/types/check.go:291 +0x45
go/types.(*Checker).checkFiles(0xc7ade3a120, 0xc1c6c0c000, 0x1791, 0x1791, 0x0, 0x0)
	C:/Program Files/Go/src/go/types/check.go:267 +0xdc
go/types.(*Checker).Files(...)
	C:/Program Files/Go/src/go/types/check.go:250
golang.org/x/tools/internal/lsp/cache.typeCheck(0x15d9498, 0xc1b8ad2180, 0xc0f88a21a0, 0xc0e47940e0, 0x2, 0xc24be51800, 0x0, 0x0, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cache/check.go:436 +0x12b3
golang.org/x/tools/internal/lsp/cache.(*snapshot).buildPackageHandle.func1(0x15d9498, 0xc1b8ad2180, 0x15c8420, 0xc0f88a21a0, 0xc12847df50, 0xb2b4e0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cache/check.go:102 +0x1d8
golang.org/x/tools/internal/memoize.(*Handle).run.func1(0xc1b8ab46e0, 0x15d9498, 0xc1b8ad2180, 0xc10e6eed60, 0x15c8420, 0xc0f88a21a0, 0xc0cb7763c0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/memoize/memoize.go:322 +0xb2
created by golang.org/x/tools/internal/memoize.(*Handle).run
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/memoize/memoize.go:315 +0x18d

goroutine 304554 [semacquire, 1 minutes]:
sync.runtime_Semacquire(0xc119314198)
	C:/Program Files/Go/src/runtime/sema.go:56 +0x49
sync.(*WaitGroup).Wait(0xc119314190)
	C:/Program Files/Go/src/sync/waitgroup.go:130 +0x6b
golang.org/x/tools/internal/lsp.(*Server).didModifyFiles.func3(0xc119314190, 0xc41eae2038, 0x1, 0x1)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/text_synchronization.go:237 +0x32
created by golang.org/x/tools/internal/lsp.(*Server).didModifyFiles
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/text_synchronization.go:236 +0x335

goroutine 303726 [runnable]:
go/types.NewVar(...)
	C:/Program Files/Go/src/go/types/object.go:264
go/types.(*Checker).shortVarDecl(0xc0d60185a0, 0x15c9320, 0xc0ed76e4f8, 0xc05d77baa0, 0x2, 0x2, 0xc03db58c60, 0x1, 0x1)
	C:/Program Files/Go/src/go/types/assignments.go:323 +0x66d
go/types.(*Checker).stmt(0xc0d60185a0, 0x0, 0x15d7680, 0xc05d779d40)
	C:/Program Files/Go/src/go/types/stmt.go:408 +0x3d25
go/types.(*Checker).stmtList(0xc0d60185a0, 0x0, 0xc03c4c1e80, 0x5, 0x8)
	C:/Program Files/Go/src/go/types/stmt.go:120 +0xe6
go/types.(*Checker).stmt(0xc0d60185a0, 0x0, 0x15d77a0, 0xc04c741230)
	C:/Program Files/Go/src/go/types/stmt.go:495 +0x482a
go/types.(*Checker).stmt(0xc0d60185a0, 0x0, 0x15d7b30, 0xc05d779e00)
	C:/Program Files/Go/src/go/types/stmt.go:507 +0x4b71
go/types.(*Checker).stmtList(0xc0d60185a0, 0x0, 0xc03cfc0000, 0x6, 0x8)
	C:/Program Files/Go/src/go/types/stmt.go:120 +0xe6
go/types.(*Checker).funcBody(0xc0d60185a0, 0xc1141b34a0, 0xc05d76b354, 0x6, 0xc174521500, 0xc04c741260, 0x0, 0x0)
	C:/Program Files/Go/src/go/types/stmt.go:42 +0x1f3
go/types.(*Checker).funcDecl.func1()
	C:/Program Files/Go/src/go/types/decl.go:749 +0x6e
go/types.(*Checker).processDelayed(0xc0d60185a0, 0x0)
	C:/Program Files/Go/src/go/types/check.go:291 +0x45
go/types.(*Checker).checkFiles(0xc0d60185a0, 0xc0e0620000, 0x1791, 0x1791, 0x0, 0x0)
	C:/Program Files/Go/src/go/types/check.go:267 +0xdc
go/types.(*Checker).Files(...)
	C:/Program Files/Go/src/go/types/check.go:250
golang.org/x/tools/internal/lsp/cache.typeCheck(0x15d9498, 0xc823069c00, 0xc08887a9c0, 0xc0e47940e0, 0x2, 0xc24be51800, 0x0, 0x0, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cache/check.go:436 +0x12b3
golang.org/x/tools/internal/lsp/cache.(*snapshot).buildPackageHandle.func1(0x15d9498, 0xc823069c00, 0x15c8420, 0xc08887a9c0, 0xc04e565b00, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cache/check.go:102 +0x1d8
golang.org/x/tools/internal/memoize.(*Handle).run.func1(0xc070b6bc00, 0x15d9498, 0xc823069c00, 0xc10e6eed60, 0x15c8420, 0xc08887a9c0, 0xc0cb7763c0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/memoize/memoize.go:322 +0xb2
created by golang.org/x/tools/internal/memoize.(*Handle).run
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/memoize/memoize.go:315 +0x18d

goroutine 317752 [runnable]:
go/types.(*Checker).recordSelection(0xc41eeb8000, 0xc09a4bb560, 0x0, 0x15cc650, 0xc18aea60f0, 0x15e97a0, 0xc1999784b0, 0xc1f9b914f0, 0x2, 0x2, ...)
	C:/Program Files/Go/src/go/types/check.go:407 +0x16e
go/types.(*Checker).selector(0xc41eeb8000, 0xc17dc11380, 0xc09a4bb560)
	C:/Program Files/Go/src/go/types/call.go:497 +0x91f
go/types.(*Checker).exprInternal(0xc41eeb8000, 0xc17dc11380, 0x15d7d70, 0xc09a4bb560, 0x0, 0x0, 0x20305f7)
	C:/Program Files/Go/src/go/types/expr.go:1322 +0x2838
go/types.(*Checker).rawExpr(0xc41eeb8000, 0xc17dc11380, 0x15d7d70, 0xc09a4bb560, 0x0, 0x0, 0x40)
	C:/Program Files/Go/src/go/types/expr.go:1029 +0x88
go/types.(*Checker).multiExpr(0xc41eeb8000, 0xc17dc11380, 0x15d7d70, 0xc09a4bb560)
	C:/Program Files/Go/src/go/types/expr.go:1652 +0x5f
go/types.(*Checker).expr(0xc41eeb8000, 0xc17dc11380, 0x15d7d70, 0xc09a4bb560)
	C:/Program Files/Go/src/go/types/expr.go:1646 +0x50
go/types.(*Checker).binary(0xc41eeb8000, 0xc17dc11380, 0xc09a4c92f0, 0x15d7d70, 0xc09a4bb560, 0x15d7740, 0xc09a4cc4e0, 0x2c, 0x10be5aa4)
	C:/Program Files/Go/src/go/types/expr.go:808 +0x96
go/types.(*Checker).exprInternal(0xc41eeb8000, 0xc17dc11380, 0x15d7770, 0xc09a4c92f0, 0x0, 0x0, 0x20305f7)
	C:/Program Files/Go/src/go/types/expr.go:1553 +0x1dc5
go/types.(*Checker).rawExpr(0xc41eeb8000, 0xc17dc11380, 0x15d7770, 0xc09a4c92f0, 0x0, 0x0, 0x40)
	C:/Program Files/Go/src/go/types/expr.go:1029 +0x88
go/types.(*Checker).multiExpr(0xc41eeb8000, 0xc17dc11380, 0x15d7770, 0xc09a4c92f0)
	C:/Program Files/Go/src/go/types/expr.go:1652 +0x5f
go/types.(*Checker).expr(0xc41eeb8000, 0xc17dc11380, 0x15d7770, 0xc09a4c92f0)
	C:/Program Files/Go/src/go/types/expr.go:1646 +0x50
go/types.(*Checker).stmt(0xc41eeb8000, 0x0, 0x15d7b30, 0xc09a4d0080)
	C:/Program Files/Go/src/go/types/stmt.go:503 +0x4b25
go/types.(*Checker).stmtList(0xc41eeb8000, 0x0, 0xc099f4b200, 0x9, 0x10)
	C:/Program Files/Go/src/go/types/stmt.go:120 +0xe6
go/types.(*Checker).funcBody(0xc41eeb8000, 0xc14c207020, 0xc099f67110, 0x14, 0xc1949f34d0, 0xc09a4c9440, 0x0, 0x0)
	C:/Program Files/Go/src/go/types/stmt.go:42 +0x1f3
go/types.(*Checker).funcDecl.func1()
	C:/Program Files/Go/src/go/types/decl.go:749 +0x6e
go/types.(*Checker).processDelayed(0xc41eeb8000, 0x0)
	C:/Program Files/Go/src/go/types/check.go:291 +0x45
go/types.(*Checker).checkFiles(0xc41eeb8000, 0xc1268e8000, 0x1791, 0x1791, 0x0, 0x0)
	C:/Program Files/Go/src/go/types/check.go:267 +0xdc
go/types.(*Checker).Files(...)
	C:/Program Files/Go/src/go/types/check.go:250
golang.org/x/tools/internal/lsp/cache.typeCheck(0x15d9498, 0xc33a9a0f00, 0xc0b777c1a0, 0xc0e47940e0, 0x2, 0xc24be51800, 0x0, 0x0, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cache/check.go:436 +0x12b3
golang.org/x/tools/internal/lsp/cache.(*snapshot).buildPackageHandle.func1(0x15d9498, 0xc33a9a0f00, 0x15c8420, 0xc0b777c1a0, 0xc0f920c060, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cache/check.go:102 +0x1d8
golang.org/x/tools/internal/memoize.(*Handle).run.func1(0xc09a69de00, 0x15d9498, 0xc33a9a0f00, 0xc10e6eed60, 0x15c8420, 0xc0b777c1a0, 0xc0cb7763c0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/memoize/memoize.go:322 +0xb2
created by golang.org/x/tools/internal/memoize.(*Handle).run
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/memoize/memoize.go:315 +0x18d

goroutine 304553 [select, 1 minutes]:
golang.org/x/tools/internal/memoize.(*Handle).wait(0xc0cb7763c0, 0x15d9540, 0xc82a106570, 0x0, 0x0, 0x0, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/memoize/memoize.go:361 +0xf9
golang.org/x/tools/internal/memoize.(*Handle).run(0xc0cb7763c0, 0x15d9540, 0xc82a106570, 0xc42a805110, 0x15c8420, 0xc0f88a21a0, 0xc1935c1680, 0xdb39bc4658a8a901, 0xdb00000000ad19dc, 0x3)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/memoize/memoize.go:352 +0x1b8
golang.org/x/tools/internal/memoize.(*Handle).Get(0xc0cb7763c0, 0x15d9540, 0xc82a106570, 0xc42a805110, 0x15c8420, 0xc0f88a21a0, 0x0, 0x0, 0x0, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/memoize/memoize.go:287 +0x20d
golang.org/x/tools/internal/lsp/cache.(*packageHandle).check(0xc2620c6060, 0x15d9540, 0xc82a106570, 0xc0f88a21a0, 0x1e, 0x2, 0xc2620c6060)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cache/check.go:233 +0x6c
golang.org/x/tools/internal/lsp/cache.(*snapshot).checkedPackage(0xc0f88a21a0, 0x15d9540, 0xc82a106570, 0xc025d89160, 0x1e, 0x2, 0x8, 0x10, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cache/snapshot.go:567 +0xcf
golang.org/x/tools/internal/lsp/cache.(*snapshot).WorkspacePackages(0xc0f88a21a0, 0x15d9540, 0xc82a106570, 0x12, 0x1a6ee40, 0xc000488700, 0x0, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cache/snapshot.go:768 +0x16e
golang.org/x/tools/internal/lsp/mod.DiagnosticsForMod(0x15d9540, 0xc82a106570, 0x15eb280, 0xc0f88a21a0, 0x2b836e57bb8, 0xc000466230, 0xc000466230, 0x0, 0x0, 0xc82a106660, ...)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/mod/diagnostics.go:89 +0xa1f
golang.org/x/tools/internal/lsp/mod.Diagnostics(0x15d9540, 0xc82a106570, 0x15eb280, 0xc0f88a21a0, 0x0, 0x0, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/mod/diagnostics.go:31 +0x651
golang.org/x/tools/internal/lsp.(*Server).diagnose(0xc00019e2a0, 0x15d9540, 0xc75e2fb4d0, 0x15eb280, 0xc0f88a21a0, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/diagnostics.go:177 +0x327
golang.org/x/tools/internal/lsp.(*Server).diagnoseSnapshot.func1()
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/diagnostics.go:110 +0x77
golang.org/x/tools/internal/lsp.(*debouncer).debounce(0xc000072730, 0xc0004e6e90, 0x10, 0x264, 0xee6b280, 0xc1261d7ef8)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/debounce.go:79 +0x32a
golang.org/x/tools/internal/lsp.(*Server).diagnoseSnapshot(0xc00019e2a0, 0x15eb280, 0xc0f88a21a0, 0xc1430a3fa0, 0x1, 0x1, 0xc1ad95a000)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/diagnostics.go:109 +0x3fa
golang.org/x/tools/internal/lsp.(*Server).didModifyFiles.func2(0xc119314190, 0xc00019e2a0, 0x1, 0x15eb280, 0xc0f88a21a0, 0xc1430a3fa0, 0x1, 0x1)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/text_synchronization.go:232 +0xaa
created by golang.org/x/tools/internal/lsp.(*Server).didModifyFiles
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/text_synchronization.go:230 +0x2c5

goroutine 316753 [semacquire, 1 minutes]:
sync.runtime_Semacquire(0xc1342eb468)
	C:/Program Files/Go/src/runtime/sema.go:56 +0x49
sync.(*WaitGroup).Wait(0xc1342eb460)
	C:/Program Files/Go/src/sync/waitgroup.go:130 +0x6b
golang.org/x/tools/internal/memoize.(*Generation).Destroy(0xc1342eb440)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/memoize/memoize.go:74 +0x5d
created by golang.org/x/tools/internal/lsp/cache.(*View).invalidateContent
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cache/view.go:627 +0x1ef

goroutine 304552 [semacquire, 1 minutes]:
sync.runtime_Semacquire(0xc6b8140508)
	C:/Program Files/Go/src/runtime/sema.go:56 +0x49
sync.(*WaitGroup).Wait(0xc6b8140500)
	C:/Program Files/Go/src/sync/waitgroup.go:130 +0x6b
golang.org/x/tools/internal/memoize.(*Generation).Destroy(0xc6b81404e0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/memoize/memoize.go:74 +0x5d
created by golang.org/x/tools/internal/lsp/cache.(*View).invalidateContent
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cache/view.go:627 +0x1ef

goroutine 290500 [semacquire, 1 minutes]:
sync.runtime_Semacquire(0xc163d5e2f8)
	C:/Program Files/Go/src/runtime/sema.go:56 +0x49
sync.(*WaitGroup).Wait(0xc163d5e2f0)
	C:/Program Files/Go/src/sync/waitgroup.go:130 +0x6b
golang.org/x/tools/internal/memoize.(*Generation).Destroy(0xc163d5e2d0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/memoize/memoize.go:74 +0x5d
created by golang.org/x/tools/internal/lsp/cache.(*View).invalidateContent
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cache/view.go:627 +0x1ef

goroutine 276479 [runnable]:
go/types.(*operand).assignableTo(0xc17dc262c0, 0xc3fbd64000, 0x15cc5b0, 0x1a08080, 0xc0d719e940, 0x0, 0x1)
	C:/Program Files/Go/src/go/types/operand.go:219 +0x8d8
go/types.(*Checker).assignment(0xc3fbd64000, 0xc17dc262c0, 0x15cc5b0, 0x1a08080, 0x14a4fe9, 0x10)
	C:/Program Files/Go/src/go/types/assignments.go:77 +0x478
go/types.(*Checker).initVar(0xc3fbd64000, 0xc3e78a7720, 0xc17dc262c0, 0x14a4fe9, 0x10, 0x15b6700, 0x0)
	C:/Program Files/Go/src/go/types/assignments.go:141 +0x151
go/types.(*Checker).initVars(0xc3fbd64000, 0xc3e6cd0b20, 0x1, 0x1, 0xc08ba8c1b0, 0x1, 0x1, 0xfcba853)
	C:/Program Files/Go/src/go/types/assignments.go:264 +0x633
go/types.(*Checker).stmt(0xc3fbd64000, 0x0, 0x15d7d10, 0xc08ba8ba00)
	C:/Program Files/Go/src/go/types/stmt.go:457 +0x3b38
go/types.(*Checker).stmtList(0xc3fbd64000, 0x0, 0xc08ba8ba20, 0x2, 0x2)
	C:/Program Files/Go/src/go/types/stmt.go:120 +0xe6
go/types.(*Checker).funcBody(0xc3fbd64000, 0xc1e3c76ba0, 0xc08afe57d0, 0x17, 0xc3e78a3140, 0xc08ba8e2a0, 0x0, 0x0)
	C:/Program Files/Go/src/go/types/stmt.go:42 +0x1f3
go/types.(*Checker).funcDecl.func1()
	C:/Program Files/Go/src/go/types/decl.go:749 +0x6e
go/types.(*Checker).processDelayed(0xc3fbd64000, 0x0)
	C:/Program Files/Go/src/go/types/check.go:291 +0x45
go/types.(*Checker).checkFiles(0xc3fbd64000, 0xc1ad8e4000, 0x1791, 0x1791, 0x0, 0x0)
	C:/Program Files/Go/src/go/types/check.go:267 +0xdc
go/types.(*Checker).Files(...)
	C:/Program Files/Go/src/go/types/check.go:250
golang.org/x/tools/internal/lsp/cache.typeCheck(0x15d9498, 0xc19ffbad00, 0xc19249c270, 0xc0e47940e0, 0x2, 0xc24be51800, 0x0, 0x0, 0x0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cache/check.go:436 +0x12b3
golang.org/x/tools/internal/lsp/cache.(*snapshot).buildPackageHandle.func1(0x15d9498, 0xc19ffbad00, 0x15c8420, 0xc19249c270, 0x13557a0, 0xc1977b5510)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cache/check.go:102 +0x1d8
golang.org/x/tools/internal/memoize.(*Handle).run.func1(0xc3e64adbe0, 0x15d9498, 0xc19ffbad00, 0xc10e6eed60, 0x15c8420, 0xc19249c270, 0xc0cb7763c0)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/memoize/memoize.go:322 +0xb2
created by golang.org/x/tools/internal/memoize.(*Handle).run
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/memoize/memoize.go:315 +0x18d

goroutine 290477 [semacquire, 1 minutes]:
sync.runtime_Semacquire(0xc3eae59fa8)
	C:/Program Files/Go/src/runtime/sema.go:56 +0x49
sync.(*WaitGroup).Wait(0xc3eae59fa0)
	C:/Program Files/Go/src/sync/waitgroup.go:130 +0x6b
golang.org/x/tools/internal/memoize.(*Generation).Destroy(0xc3eae59f80)
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/memoize/memoize.go:74 +0x5d
created by golang.org/x/tools/internal/lsp/cache.(*View).invalidateContent
	C:/Users/ioot/go/pkg/mod/golang.org/x/tools@v0.1.1-0.20210222172741-77e031214674/internal/lsp/cache/view.go:627 +0x1ef
[Error - 2:54:06 am] Connection to server got closed. Server will not be restarted.

Failed to auto-collect gopls trace: unrecognized crash pattern.

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>

@hyangah
Copy link
Contributor

@hyangah hyangah commented Mar 14, 2021

Thanks for the report. @twocs Transferring to gopls issue tracker for triaging.

cc @stamblerre @findleyr

@hyangah hyangah changed the title gopls: automated issue report (crash) x/tools/gopls: crash in go/types.(*Checker).recordTypeAndValue Mar 14, 2021
@hyangah hyangah transferred this issue from golang/vscode-go Mar 14, 2021
@gopherbot gopherbot added this to the Unreleased milestone Mar 14, 2021
@findleyr
Copy link
Contributor

@findleyr findleyr commented Mar 14, 2021

This panic is mysterious to me. Some kind of memory corruption?

@twocs which version of Go are you using?

@twocs
Copy link
Author

@twocs twocs commented Mar 15, 2021

go version
go version go1.16.2 windows/amd64

I see a (possibly) related issue
https://go-review.googlesource.com/c/tools/+/292730/

internal/lsp: fix nil pointer in hover when (types.Object).Pkg() is nil
We haven't been able to reproduce this scenario, but it may be possible
when the user is in a broken state. Avoid panicking by gating every
use of obj.Pkg() with nil checks.

Not really sure what happened. I was moving my mouse to hover over a series of different lines when the panic occurred.

@findleyr
Copy link
Contributor

@findleyr findleyr commented Mar 15, 2021

I see a (possibly) related issue
https://go-review.googlesource.com/c/tools/+/292730/

Thanks for investigating. That CL fixed a NPE in our code, but the panic above ("unexpected fault address 0xffffffffffffffff") points to some kind of runtime corruption. I don't think anything particularly implicates gopls or go/types, though I suppose perhaps this could be the result of some race that has gone undetected.

Given that this is the first report of its kind that we've received, unless it is reproducible I'm inclined to think it might be a problem with your computer. However, my runtime knowledge is limited.

CC @cherrymui, who is on interrupts and also happens to be a member of the runtime team :)

@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented Mar 15, 2021

runtime.sigpanic()
C:/Program Files/Go/src/runtime/signal_windows.go:245 +0x2d6 fp=0xc19ac35f58 sp=0xc19ac35f00 pc=0xb11e16
runtime.interhash(0xc7058effa8, 0xda9bf5fa, 0xc7058f0060)
C:/Program Files/Go/src/runtime/alg.go:102 +0x39 fp=0xc19ac35fa0 sp=0xc19ac35f58 pc=0xac3659

It seems this is loading itab._type. It is quite weird that this field is bad. Is there anyway that I can reproduce this? Thanks.

@stamblerre stamblerre removed this from the Unreleased milestone Mar 15, 2021
@stamblerre stamblerre added this to the gopls/unplanned milestone Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants