golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.38k stars 17.7k forks source link

x/tools/gopls: crash during renaming #53277

Closed bigpigeon closed 2 years ago

bigpigeon commented 2 years ago

gopls version: v0.8.3 (go1.18) gopls flags: update flags: proxy extension version: 0.33.0 go version: 1.18 environment: Visual Studio Code linux initialization error: undefined issue timestamp: Sat, 07 May 2022 07:36:54 GMT restart history: Fri, 06 May 2022 06:34:07 GMT: activation (enabled: true) Fri, 06 May 2022 06:36:06 GMT: config change (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

Rename function name failure, got “Connection got disposed.” event

goroutine 11224 [running]:
golang.org/x/tools/refactor/satisfy.(*Finder).expr(0xc00808b890, {0x10557d8?, 0xc00bb299e0?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/refactor/satisfy/find.go:472 +0xccf
golang.org/x/tools/refactor/satisfy.(*Finder).expr(0xc00808b890, {0x1055d48?, 0xc00bb29a10?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/refactor/satisfy/find.go:411 +0x793
golang.org/x/tools/refactor/satisfy.(*Finder).expr(0xc00808b890, {0x1055988?, 0xc0102b3980?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/refactor/satisfy/find.go:446 +0xd98
golang.org/x/tools/refactor/satisfy.(*Finder).expr(0xc00808b890, {0x1055a48?, 0xc0102b3b00?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/refactor/satisfy/find.go:369 +0xfb5
golang.org/x/tools/refactor/satisfy.(*Finder).expr(0xc00808b890, {0x10560d8?, 0xc008bfd2a0?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/refactor/satisfy/find.go:453 +0x45a
golang.org/x/tools/refactor/satisfy.(*Finder).call(0xc00808b890, 0xc00905dac0, {0xc00a640050, 0x1, 0x1542fe0?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/refactor/satisfy/find.go:183 +0x492
golang.org/x/tools/refactor/satisfy.(*Finder).exprN(0xc00808b890, {0x1055988?, 0xc0102b3b40?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/refactor/satisfy/find.go:136 +0x147
golang.org/x/tools/refactor/satisfy.(*Finder).stmt(0xc00808b890, {0x1055808?, 0xc0102b3b80?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/refactor/satisfy/find.go:517 +0x8fc
golang.org/x/tools/refactor/satisfy.(*Finder).stmt(0xc00808b890, {0x1055928?, 0xc00bb29d10?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/refactor/satisfy/find.go:572 +0xbc5
golang.org/x/tools/refactor/satisfy.(*Finder).Find(0xc00808b890, 0xc017be0af0?, {0xc020dc1600, 0x14, 0x1?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/refactor/satisfy/find.go:111 +0x1c5
golang.org/x/tools/internal/lsp/source.(*renamer).satisfy(0xc000320000)
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/internal/lsp/source/rename_check.go:800 +0xdc
golang.org/x/tools/internal/lsp/source.(*renamer).checkMethod(0xc000320000, 0xc00b56f040)
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/internal/lsp/source/rename_check.go:718 +0x2d4
golang.org/x/tools/internal/lsp/source.(*renamer).check(0xc000320000, {0x105dbe8, 0xc00b56f040?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/internal/lsp/source/rename_check.go:46 +0x16b
golang.org/x/tools/internal/lsp/source.Rename({0x1057068?, 0xc007be20c0?}, {0x105fb20, 0xc00b699c20}, {0x10573b0, 0xc0089e83c0}, {0x20db3638?, 0xc0?}, {0xc010f6c320, 0xe})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/internal/lsp/source/rename.go:148 +0x945
golang.org/x/tools/internal/lsp.(*Server).rename(0xc96240?, {0x1057068, 0xc007be20c0}, 0xc0078fa000)
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/internal/lsp/rename.go:20 +0x10d
golang.org/x/tools/internal/lsp.(*Server).Rename(0xc00f17a480?, {0x1057068?, 0xc007be20c0?}, 0xc96240?)
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/internal/lsp/server_gen.go:224 +0x25
golang.org/x/tools/internal/lsp/protocol.serverDispatch({0x1057068, 0xc007be20c0}, {0x1063690, 0xc000148240}, 0xc00808a0c0, {0x1057308, 0xc007be2000})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/internal/lsp/protocol/tsserver.go:592 +0xbba
golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1({0x1057068, 0xc007be20c0}, 0xc00808a0c0, {0x1057308, 0xc007be2000})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/internal/lsp/protocol/protocol.go:154 +0x90
golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1({0x1057068, 0xc007be20c0}, 0xc00808a0c0, {0x1057308?, 0xc007be2000?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/internal/lsp/lsprpc/lsprpc.go:512 +0xa43
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1({0x1057068, 0xc007be20c0}, 0xc017a82f00, {0x1057308?, 0xc007be2000?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/internal/jsonrpc2/handler.go:35 +0xf6
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2()
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/internal/jsonrpc2/handler.go:103 +0xa3
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220407163324-91bcfb1bdf9c/internal/jsonrpc2/handler.go:100 +0x20a
[Error - 3:36:45 PM] Connection to server got closed. Server will not be restarted.
[Error - 3:36:45 PM] Request textDocument/rename failed.
Error: Connection got disposed.
    at Object.dispose (/home/jia/.vscode/extensions/golang.go-0.33.0/dist/goMain.js:4909:25)
    at Object.dispose (/home/jia/.vscode/extensions/golang.go-0.33.0/dist/goMain.js:9694:35)
    at LanguageClient2.handleConnectionClosed (/home/jia/.vscode/extensions/golang.go-0.33.0/dist/goMain.js:11902:38)
    at LanguageClient2.handleConnectionClosed (/home/jia/.vscode/extensions/golang.go-0.33.0/dist/goMain.js:14311:15)
    at closeHandler (/home/jia/.vscode/extensions/golang.go-0.33.0/dist/goMain.js:11890:16)
    at CallbackList.invoke (/home/jia/.vscode/extensions/golang.go-0.33.0/dist/goMain.js:3025:35)
    at Emitter.fire (/home/jia/.vscode/extensions/golang.go-0.33.0/dist/goMain.js:3076:34)
    at closeHandler (/home/jia/.vscode/extensions/golang.go-0.33.0/dist/goMain.js:4171:24)
    at CallbackList.invoke (/home/jia/.vscode/extensions/golang.go-0.33.0/dist/goMain.js:3025:35)
    at Emitter.fire (/home/jia/.vscode/extensions/golang.go-0.33.0/dist/goMain.js:3076:34)
    at StreamMessageReader.fireClose (/home/jia/.vscode/extensions/golang.go-0.33.0/dist/goMain.js:3218:27)
    at Socket.<anonymous> (/home/jia/.vscode/extensions/golang.go-0.33.0/dist/goMain.js:3301:42)
    at Socket.emit (node:events:402:35)
    at Pipe.<anonymous> (node:net:687:12)
jamalc commented 2 years ago

Thanks for the report. Are you able to share the log you see in the gopls output channel leading up to the crash? 106151310-3899a680-614a-11eb-9be7-42f2ae0592c9

hyangah commented 2 years ago

@bigpigeon Sorry that this issue fell through the cracks. Do you remember what kind of renaming triggered this issue? Can you share the code snippet that you tried to rename?

https://github.com/golang/tools/blob/63dfc2d3a9c936e6c11ef46dc4b4a899ea7e1e70/refactor/satisfy/find.go#L472 Is the line that triggered panic. There should've been a panic message before the stack trace. Unfortunately, that's missing.

Transferring to gopls issue tracker for investigation.

bigpigeon commented 2 years ago

here is full gopls(server) output

but the code have some company data, I can't share here, sorry

panic: (*ast.ArrayType) 0xc00aac2db0

goroutine 13758 [running]:
golang.org/x/tools/refactor/satisfy.(*Finder).expr(0xc0168de4e0, {0x10636b0?, 0xc00aac2db0?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/refactor/satisfy/find.go:468 +0xccf
golang.org/x/tools/refactor/satisfy.(*Finder).expr(0xc0168de4e0, {0x1063c20?, 0xc00aac2de0?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/refactor/satisfy/find.go:407 +0x793
golang.org/x/tools/refactor/satisfy.(*Finder).expr(0xc0168de4e0, {0x1063860?, 0xc00ac6b080?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/refactor/satisfy/find.go:442 +0xd98
golang.org/x/tools/refactor/satisfy.(*Finder).expr(0xc0168de4e0, {0x1063920?, 0xc00ac6b200?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/refactor/satisfy/find.go:365 +0xfb5
golang.org/x/tools/refactor/satisfy.(*Finder).expr(0xc0168de4e0, {0x1063fb0?, 0xc00264c720?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/refactor/satisfy/find.go:449 +0x45a
golang.org/x/tools/refactor/satisfy.(*Finder).call(0xc0168de4e0, 0xc019b45180, {0xc00260ca40, 0x1, 0x1555f80?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/refactor/satisfy/find.go:180 +0x492
golang.org/x/tools/refactor/satisfy.(*Finder).exprN(0xc0168de4e0, {0x1063860?, 0xc00ac6b240?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/refactor/satisfy/find.go:133 +0x147
golang.org/x/tools/refactor/satisfy.(*Finder).stmt(0xc0168de4e0, {0x10636e0?, 0xc00ac6b280?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/refactor/satisfy/find.go:513 +0x8fc
golang.org/x/tools/refactor/satisfy.(*Finder).stmt(0xc0168de4e0, {0x1063800?, 0xc00aac31d0?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/refactor/satisfy/find.go:568 +0xbc5
golang.org/x/tools/refactor/satisfy.(*Finder).Find(0xc0168de4e0, 0xc00cb34730?, {0xc013eaac00, 0x18, 0x1?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/refactor/satisfy/find.go:108 +0x1c5
golang.org/x/tools/internal/lsp/source.(*renamer).satisfy(0xc011c12000)
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/internal/lsp/source/rename_check.go:800 +0xdc
golang.org/x/tools/internal/lsp/source.(*renamer).checkMethod(0xc011c12000, 0xc019b69c70)
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/internal/lsp/source/rename_check.go:718 +0x2d4
golang.org/x/tools/internal/lsp/source.(*renamer).check(0xc011c12000, {0x106ba88, 0xc019b69c70?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/internal/lsp/source/rename_check.go:46 +0x16b
golang.org/x/tools/internal/lsp/source.Rename({0x1064f10?, 0xc0169d82c0?}, {0x106d9c0, 0xc0106625a0}, {0x1065258, 0xc0109d4ea0}, {0x327718?, 0xc0?}, {0xc014ce03d4, 0xb})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/internal/lsp/source/rename.go:149 +0x945
golang.org/x/tools/internal/lsp.(*Server).rename(0xca06c0?, {0x1064f10, 0xc0169d82c0}, 0xc016868000)
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/internal/lsp/rename.go:20 +0x10d
golang.org/x/tools/internal/lsp.(*Server).Rename(0xc01eba4000?, {0x1064f10?, 0xc0169d82c0?}, 0xca06c0?)
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/internal/lsp/server_gen.go:224 +0x25
golang.org/x/tools/internal/lsp/protocol.serverDispatch({0x1064f10, 0xc0169d82c0}, {0x1071530, 0xc000396480}, 0xc0168de000, {0x10651b0, 0xc0169d8000})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/internal/lsp/protocol/tsserver.go:727 +0xc5c
golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1({0x1064f10, 0xc0169d82c0}, 0xc0168de000, {0x10651b0, 0xc0169d8000})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/internal/lsp/protocol/protocol.go:157 +0x90
golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1({0x1064f10, 0xc0169d82c0}, 0xc0168de000, {0x10651b0?, 0xc0169d8000?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/internal/lsp/lsprpc/lsprpc.go:511 +0xa43
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1({0x1064f10, 0xc0169d82c0}, 0xc0089502a0, {0x10651b0?, 0xc0169d8000?})
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/internal/jsonrpc2/handler.go:35 +0xf6
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2()
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/internal/jsonrpc2/handler.go:103 +0xa3
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
    /home/jia/go/pkg/mod/golang.org/x/tools@v0.1.11-0.20220513164230-dfee1649af67/internal/jsonrpc2/handler.go:100 +0x20a
[Info  - 9:57:12 AM] Connection to server got closed. Server will restart.
[Error - 9:57:12 AM] Request textDocument/rename failed.
Error: Connection got disposed.
    at Object.dispose (/home/jia/.vscode/extensions/golang.go-0.33.1/dist/goMain.js:4909:25)
    at Object.dispose (/home/jia/.vscode/extensions/golang.go-0.33.1/dist/goMain.js:9694:35)
    at LanguageClient2.handleConnectionClosed (/home/jia/.vscode/extensions/golang.go-0.33.1/dist/goMain.js:11902:38)
    at LanguageClient2.handleConnectionClosed (/home/jia/.vscode/extensions/golang.go-0.33.1/dist/goMain.js:14311:15)
    at closeHandler (/home/jia/.vscode/extensions/golang.go-0.33.1/dist/goMain.js:11890:16)
    at CallbackList.invoke (/home/jia/.vscode/extensions/golang.go-0.33.1/dist/goMain.js:3025:35)
    at Emitter.fire (/home/jia/.vscode/extensions/golang.go-0.33.1/dist/goMain.js:3076:34)
    at closeHandler (/home/jia/.vscode/extensions/golang.go-0.33.1/dist/goMain.js:4171:24)
    at CallbackList.invoke (/home/jia/.vscode/extensions/golang.go-0.33.1/dist/goMain.js:3025:35)
    at Emitter.fire (/home/jia/.vscode/extensions/golang.go-0.33.1/dist/goMain.js:3076:34)
    at StreamMessageReader.fireClose (/home/jia/.vscode/extensions/golang.go-0.33.1/dist/goMain.js:3218:27)
    at Socket.<anonymous> (/home/jia/.vscode/extensions/golang.go-0.33.1/dist/goMain.js:3301:42)
    at Socket.emit (node:events:402:35)
    at Pipe.<anonymous> (node:net:687:12)
[Info  - 9:57:12 AM] 2022/06/08 09:57:12 go env for /home/jia/go/src/secret.company.com/sre/company_project
(root /home/jia/go/src/secret.company.com/sre/company_project)
(go version go version go1.18 linux/amd64)
(valid build configuration = true)
(build flags: [-tags wasmhost])
GOCACHE=/home/jia/.cache/go-build
GOSUMDB=off
GOINSECURE=
GOMOD=/home/jia/go/src/secret.company.com/sre/company_project/go.mod
GONOPROXY=secret.company.com
GOROOT=/usr/local/lib/go1.18
GOPROXY=goproxy.cn,mirrors.incompany.cn/go,direct
GOFLAGS=
GOWORK=
GONOSUMDB=gopkg.in/redis.v5,secret.company.com
GOPATH=/home/jia/go
GO111MODULE=auto
GOPRIVATE=secret.company.com
GOMODCACHE=/home/jia/go/pkg/mod

[Info  - 9:57:12 AM] 2022/06/08 09:57:12 go/packages.Load
    snapshot=0
    directory=/home/jia/go/src/secret.company.com/sre/company_project
    query=[builtin secret.company.com/sre/company_project/...]
    packages=24

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 falling back to safe trimming due to type errors: [/usr/local/lib/go1.18/src/runtime/vdso_linux.go:53:38: invalid operation: division by zero /usr/local/lib/go1.18/src/runtime/vdso_linux.go:54:38: invalid operation: division by zero] or still-missing identifiers: map[memRecordCycle:true pageBits:true]
    package="runtime"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 falling back to safe trimming due to type errors: [/home/jia/go/pkg/mod/google.golang.org/protobuf@v1.26.0/encoding/protowire/wire.go:27:34: invalid operation: signed shift count 29 (untyped int constant) requires go1.13 or later] or still-missing identifiers: map[]
    package="google.golang.org/protobuf/encoding/protowire"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 falling back to safe trimming due to type errors: [/home/jia/go/pkg/mod/github.com/mailru/easyjson@v0.7.7/jwriter/writer.go:17:31: invalid operation: signed shift count iota (untyped int constant 0) requires go1.13 or later /home/jia/go/pkg/mod/github.com/mailru/easyjson@v0.7.7/jwriter/writer.go:18:2: invalid operation: signed shift count iota (untyped int constant 1) requires go1.13 or later] or still-missing identifiers: map[]
    package="github.com/mailru/easyjson/jwriter"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 discovered missing identifiers: map[cardinality:true kind:true syntax:true value:true]
    package="google.golang.org/protobuf/reflect/protoreflect"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 falling back to safe trimming due to type errors: [/home/jia/go/pkg/mod/google.golang.org/protobuf@v1.26.0/runtime/protoiface/methods.go:49:50: invalid operation: signed shift count iota (untyped int constant 0) requires go1.13 or later /home/jia/go/pkg/mod/google.golang.org/protobuf@v1.26.0/runtime/protoiface/methods.go:52:2: invalid operation: signed shift count iota (untyped int constant 1) requires go1.13 or later /home/jia/go/pkg/mod/google.golang.org/protobuf@v1.26.0/runtime/protoiface/methods.go:91:48: invalid operation: signed shift count iota (untyped int constant 0) requires go1.13 or later /home/jia/go/pkg/mod/google.golang.org/protobuf@v1.26.0/runtime/protoiface/methods.go:92:2: invalid operation: signed shift count iota (untyped int constant 1) requires go1.13 or later /home/jia/go/pkg/mod/google.golang.org/protobuf@v1.26.0/runtime/protoiface/methods.go:120:53: invalid operation: signed shift count iota (untyped int constant 0) requires go1.13 or later /home/jia/go/pkg/mod/google.golang.org/protobuf@v1.26.0/runtime/protoiface/methods.go:130:51: invalid operation: signed shift count iota (untyped int constant 0) requires go1.13 or later /home/jia/go/pkg/mod/google.golang.org/protobuf@v1.26.0/runtime/protoiface/methods.go:154:40: invalid operation: signed shift count iota (untyped int constant 0) requires go1.13 or later] or still-missing identifiers: map[]
    package="google.golang.org/protobuf/runtime/protoiface"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 discovered missing identifiers: map[options:true]
    package="golang.org/x/text/unicode/bidi"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 discovered missing identifiers: map[options:true]
    package="vendor/golang.org/x/text/unicode/bidi"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 discovered missing identifiers: map[decoderOptions:true encoderOptions:true]
    package="github.com/klauspost/compress/zstd"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 falling back to safe trimming due to type errors: [/home/jia/go/pkg/mod/google.golang.org/protobuf@v1.26.0/internal/encoding/text/decode_number.go:36:23: invalid operation: signed shift count iota (untyped int constant 0) requires go1.13 or later /home/jia/go/pkg/mod/google.golang.org/protobuf@v1.26.0/internal/encoding/text/decode_number.go:37:2: invalid operation: signed shift count iota (untyped int constant 1) requires go1.13 or later /home/jia/go/pkg/mod/google.golang.org/protobuf@v1.26.0/internal/encoding/text/decode_number.go:38:2: invalid operation: signed shift count iota (untyped int constant 2) requires go1.13 or later /home/jia/go/pkg/mod/google.golang.org/protobuf@v1.26.0/internal/encoding/text/decode_number.go:39:2: invalid operation: signed shift count iota (untyped int constant 3) requires go1.13 or later /home/jia/go/pkg/mod/google.golang.org/protobuf@v1.26.0/internal/encoding/text/decode_token.go:95:27: invalid operation: signed shift count 7 (untyped int constant) requires go1.13 or later /home/jia/go/pkg/mod/google.golang.org/protobuf@v1.26.0/internal/encoding/text/decode_token.go:105:25: invalid operation: signed shift count 7 (untyped int constant) requires go1.13 or later /home/jia/go/pkg/mod/google.golang.org/protobuf@v1.26.0/internal/encoding/text/encode.go:22:20: invalid operation: signed shift count iota (untyped int constant 0) requires go1.13 or later /home/jia/go/pkg/mod/google.golang.org/protobuf@v1.26.0/internal/encoding/text/encode.go:23:2: invalid operation: signed shift count iota (untyped int constant 1) requires go1.13 or later /home/jia/go/pkg/mod/google.golang.org/protobuf@v1.26.0/internal/encoding/text/encode.go:24:2: invalid operation: signed shift count iota (untyped int constant 2) requires go1.13 or later /home/jia/go/pkg/mod/google.golang.org/protobuf@v1.26.0/internal/encoding/text/encode.go:25:2: invalid operation: signed shift count iota (untyped int constant 3) requires go1.13 or later /home/jia/go/pkg/mod/google.golang.org/protobuf@v1.26.0/internal/encoding/text/encode.go:26:2: invalid operation: signed shift count iota (untyped int constant 4) requires go1.13 or later] or still-missing identifiers: map[]
    package="google.golang.org/protobuf/internal/encoding/text"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 falling back to safe trimming due to type errors: [/home/jia/go/pkg/mod/go.mongodb.org/mongo-driver@v1.9.0/x/mongo/driver/wiremessage/wiremessage.go:79:21: invalid operation: signed shift count iota (untyped int constant 0) requires go1.13 or later /home/jia/go/pkg/mod/go.mongodb.org/mongo-driver@v1.9.0/x/mongo/driver/wiremessage/wiremessage.go:80:2: invalid operation: signed shift count iota (untyped int constant 1) requires go1.13 or later /home/jia/go/pkg/mod/go.mongodb.org/mongo-driver@v1.9.0/x/mongo/driver/wiremessage/wiremessage.go:81:2: invalid operation: signed shift count iota (untyped int constant 2) requires go1.13 or later /home/jia/go/pkg/mod/go.mongodb.org/mongo-driver@v1.9.0/x/mongo/driver/wiremessage/wiremessage.go:82:2: invalid operation: signed shift count iota (untyped int constant 3) requires go1.13 or later /home/jia/go/pkg/mod/go.mongodb.org/mongo-driver@v1.9.0/x/mongo/driver/wiremessage/wiremessage.go:83:2: invalid operation: signed shift count iota (untyped int constant 4) requires go1.13 or later /home/jia/go/pkg/mod/go.mongodb.org/mongo-driver@v1.9.0/x/mongo/driver/wiremessage/wiremessage.go:84:2: invalid operation: signed shift count iota (untyped int constant 5) requires go1.13 or later /home/jia/go/pkg/mod/go.mongodb.org/mongo-driver@v1.9.0/x/mongo/driver/wiremessage/wiremessage.go:85:2: invalid operation: signed shift count iota (untyped int constant 6) requires go1.13 or later /home/jia/go/pkg/mod/go.mongodb.org/mongo-driver@v1.9.0/x/mongo/driver/wiremessage/wiremessage.go:86:2: invalid operation: signed shift count iota (untyped int constant 7) requires go1.13 or later /home/jia/go/pkg/mod/go.mongodb.org/mongo-driver@v1.9.0/x/mongo/driver/wiremessage/wiremessage.go:124:33: invalid operation: signed shift count iota (untyped int constant 0) requires go1.13 or later /home/jia/go/pkg/mod/go.mongodb.org/mongo-driver@v1.9.0/x/mongo/driver/wiremessage/wiremessage.go:125:2: invalid operation: signed shift count iota (untyped int constant 1) requires go1.13 or later /home/jia/go/pkg/mod/go.mongodb.org/mongo-driver@v1.9.0/x/mongo/driver/wiremessage/wiremessage.go:127:32: invalid operation: signed shift count 16 (untyped int constant) requires go1.13 or later /home/jia/go/pkg/mod/go.mongodb.org/mongo-driver@v1.9.0/x/mongo/driver/wiremessage/wiremessage.go:135:34: invalid operation: signed shift count iota (untyped int constant 0) requires go1.13 or later /home/jia/go/pkg/mod/go.mongodb.org/mongo-driver@v1.9.0/x/mongo/driver/wiremessage/wiremessage.go:136:2: invalid operation: signed shift count iota (untyped int constant 1) requires go1.13 or later /home/jia/go/pkg/mod/go.mongodb.org/mongo-driver@v1.9.0/x/mongo/driver/wiremessage/wiremessage.go:137:2: invalid operation: signed shift count iota (untyped int constant 2) requires go1.13 or later /home/jia/go/pkg/mod/go.mongodb.org/mongo-driver@v1.9.0/x/mongo/driver/wiremessage/wiremessage.go:138:2: invalid operation: signed shift count iota (untyped int constant 3) requires go1.13 or later] or still-missing identifiers: map[]
    package="go.mongodb.org/mongo-driver/x/mongo/driver/wiremessage"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 falling back to safe trimming due to type errors: [/home/jia/go/pkg/mod/github.com/aws/aws-sdk-go@v1.43.42/aws/endpoints/v3model.go:38:37: invalid operation: signed shift count (64 - 1 - iota) (untyped int constant 63) requires go1.13 or later /home/jia/go/pkg/mod/github.com/aws/aws-sdk-go@v1.43.42/aws/endpoints/v3model.go:41:2: invalid operation: signed shift count (64 - 1 - iota) (untyped int constant 62) requires go1.13 or later] or still-missing identifiers: map[defaultKey:true endpointKey:true region:true service:true]
    package="github.com/aws/aws-sdk-go/aws/endpoints"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 discovered missing identifiers: map[signOption:true]
    package="secret.company.com/sre-dev/kpackage/signature"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 discovered missing identifiers: map[cpuMask:true]
    package="golang.org/x/sys/unix"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 falling back to safe trimming due to type errors: [/home/jia/go/pkg/mod/github.com/aws/aws-sdk-go@v1.43.42/aws/logger.go:58:54: invalid operation: signed shift count iota (untyped int constant 0) requires go1.13 or later /home/jia/go/pkg/mod/github.com/aws/aws-sdk-go@v1.43.42/aws/logger.go:64:2: invalid operation: signed shift count iota (untyped int constant 1) requires go1.13 or later /home/jia/go/pkg/mod/github.com/aws/aws-sdk-go@v1.43.42/aws/logger.go:69:2: invalid operation: signed shift count iota (untyped int constant 2) requires go1.13 or later /home/jia/go/pkg/mod/github.com/aws/aws-sdk-go@v1.43.42/aws/logger.go:73:2: invalid operation: signed shift count iota (untyped int constant 3) requires go1.13 or later /home/jia/go/pkg/mod/github.com/aws/aws-sdk-go@v1.43.42/aws/logger.go:79:2: invalid operation: signed shift count iota (untyped int constant 4) requires go1.13 or later /home/jia/go/pkg/mod/github.com/aws/aws-sdk-go@v1.43.42/aws/logger.go:82:2: invalid operation: signed shift count iota (untyped int constant 5) requires go1.13 or later] or still-missing identifiers: map[]
    package="github.com/aws/aws-sdk-go/aws"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 discovered missing identifiers: map[unknownFieldsA:true]
    package="google.golang.org/protobuf/internal/impl"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 discovered missing identifiers: map[channel:true]
    package="github.com/go-redis/redis/v8"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 discovered missing identifiers: map[credentialValueProvider:true]
    package="github.com/aws/aws-sdk-go/aws/signer/v4"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 discovered missing identifiers: map[config:true connectionConfig:true serverConfig:true]
    package="go.mongodb.org/mongo-driver/x/mongo/driver/topology"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 falling back to safe trimming due to type errors: [/home/jia/go/pkg/mod/go.mongodb.org/mongo-driver@v1.9.0/mongo/errors.go:576:29: invalid operation: signed shift count iota (untyped int constant 0) requires go1.13 or later /home/jia/go/pkg/mod/go.mongodb.org/mongo-driver@v1.9.0/mongo/errors.go:577:2: invalid operation: signed shift count iota (untyped int constant 1) requires go1.13 or later /home/jia/go/pkg/mod/go.mongodb.org/mongo-driver@v1.9.0/mongo/errors.go:578:2: invalid operation: signed shift count iota (untyped int constant 2) requires go1.13 or later] or still-missing identifiers: map[]
    package="go.mongodb.org/mongo-driver/mongo"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 discovered missing identifiers: map[netIPSocketLine:true]
    package="github.com/prometheus/procfs"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 discovered missing identifiers: map[goOptions:true]
    package="github.com/prometheus/client_golang/prometheus/collectors"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 discovered missing identifiers: map[option:true]
    package="github.com/prometheus/client_golang/prometheus/promhttp"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 discovered missing identifiers: map[yaml_style_t:true]
    package="gopkg.in/yaml.v3"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 discovered missing identifiers: map[debugMethod:true]
    package="net/rpc"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 falling back to safe trimming due to type errors: [/usr/local/lib/go1.18/src/internal/buildcfg/exp.go:24:38: 2-valued (func() (goexperiment.Flags, goexperiment.Flags) literal)() (value of type (goexperiment.Flags, goexperiment.Flags)) where single value is expected] or still-missing identifiers: map[]
    package="internal/buildcfg"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 discovered missing identifiers: map[message:true]
    package="internal/profile"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 discovered missing identifiers: map[yaml_style_t:true]
    package="gopkg.in/yaml.v2"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 falling back to safe trimming due to type errors: [/home/jia/go/pkg/mod/github.com/go-openapi/swag@v0.19.15/convert.go:25:36: invalid operation: signed shift count 53 (untyped int constant) requires go1.13 or later /home/jia/go/pkg/mod/github.com/go-openapi/swag@v0.19.15/convert.go:26:37: invalid operation: signed shift count 53 (untyped int constant) requires go1.13 or later] or still-missing identifiers: map[]
    package="github.com/go-openapi/swag"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 discovered missing identifiers: map[term:true]
    package="go/types"

[Info  - 9:57:13 AM] 2022/06/08 09:57:13 discovered missing identifiers: map[intf2impl:true]
    package="github.com/ugorji/go/codec"

[Error - 9:57:14 AM] 2022/06/08 09:57:14 tidy: diagnosing file:///home/jia/go/src/secret.company.com/sre/company_project/go.mod: err: exit status 1: stderr: go: downloading github.com/onsi/ginkgo v1.16.5
go: downloading github.com/onsi/gomega v1.18.1
secret.company.com/sre/company_project/internal/dao imports
    github.com/go-redis/redis/v8 tested by
    github.com/go-redis/redis/v8.test imports
    github.com/onsi/ginkgo: module lookup disabled by GOPROXY=off
secret.company.com/sre/company_project/internal/dao imports
    github.com/go-redis/redis/v8 tested by
    github.com/go-redis/redis/v8.test imports
    github.com/onsi/gomega: module lookup disabled by GOPROXY=off

[Error - 9:57:14 AM] 2022/06/08 09:57:14 tidy: diagnosing file:///home/jia/go/src/secret.company.com/sre/company_project/go.mod: err: exit status 1: stderr: go: downloading github.com/onsi/ginkgo v1.16.5
go: downloading github.com/onsi/gomega v1.18.1
secret.company.com/sre/company_project/internal/dao imports
    github.com/go-redis/redis/v8 tested by
    github.com/go-redis/redis/v8.test imports
    github.com/onsi/ginkgo: module lookup disabled by GOPROXY=off
secret.company.com/sre/company_project/internal/dao imports
    github.com/go-redis/redis/v8 tested by
    github.com/go-redis/redis/v8.test imports
    github.com/onsi/gomega: module lookup disabled by GOPROXY=off
findleyr commented 2 years ago

CC @adonovan

Were you working on generic code, by any chance? Based on the stack it doesn't seem related to generics, but since we haven't seen this before I am suspicious. Thanks.

jens1205 commented 2 years ago

I have indeed a similar problem, using

In a file with generic code, while renaming methods on a non generic struct gopls crashes

I'm using nvim here, but although I configured the logfile

    cmd = { "gopls", "-logfile=/tmp/gopls.log", "-vv", "-rpc.trace", "--debug=localhost:6060" },

I get only the following log

[Trace - 14:52:18.137 PM] Received response 'textDocument/prepareRename - (4)' in 9ms.
Result: {"range":{"start":{"line":225,"character":29},"end":{"line":225,"character":37}},"placeholder":"Iterator"}

[Trace - 14:52:19.287 PM] Sending request 'textDocument/rename - (5)'.
Params: {"newName":"Iteratora","position":{"line":225,"character":29},"textDocument":{"uri":"file:\/\/\/Users\/a1167272\/asf\/apps\/product-ordering-management\/order-service\/integrationtest\/orderstatelistener.go"}}
jens1205 commented 2 years ago

Interesting enough I can:

The only thing which let gopls crash is:

But I haven't been able to compile a reduced example which is enough to reproduce the behaviour.

adonovan commented 2 years ago

This is almost certainly a dup of #52940, which was fixed by https://go-review.googlesource.com/c/tools/+/413690. That bug affected only generic code, but was sensitive to any generic code in the workspace since the tool has to scan for all possible assignments that relate concrete types to interfaces. Please try the latest gopls and let us know if you still encounter problems.