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 filepath.Walk during go.work completion #64225

Closed
muse-jimmy opened this issue Nov 17, 2023 · 2 comments
Closed

x/tools/gopls: crash in filepath.Walk during go.work completion #64225

muse-jimmy opened this issue Nov 17, 2023 · 2 comments
Assignees
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@muse-jimmy
Copy link

gopls version: v0.14.2 (go1.18rc1)
gopls flags:
update flags: proxy
extension version: 0.40.0
go version: 1.18rc1
environment: Visual Studio Code darwin
initialization error: undefined
issue timestamp: Fri, 17 Nov 2023 04:51:16 GMT
restart history:
Fri, 17 Nov 2023 03:37:10 GMT: activation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x10125b7cc]

goroutine 12 [running]:
golang.org/x/tools/gopls/internal/lsp/work.Completion.func1({0x14000786740, 0x39}, {0x0%3F, 0x0%3F}, {0x1400033f368%3F, 0x1400073ad60%3F})
	  completion.go:88  0x10c
path/filepath.walk({0x1400073ad60, 0xf}, {0x1016dcda8, 0x140003a4f70}, 0x140003b3368)
	  path.go:438  0x180
path/filepath.walk({0x1400090edc0, 0x8}, {0x1016dcda8, 0x140001e1ee0}, 0x140003b3368)
	  path.go:442  0x1fc
path/filepath.walk({0x101b9af38, 0x1}, {0x1016dcda8, 0x1400018a0d0}, 0x140003b3368)
	  path.go:442  0x1fc
path/filepath.Walk({0x101b9af38, 0x1}, 0x1400036d368)
	  path.go:505  0x70
golang.org/x/tools/gopls/internal/lsp/work.Completion({0x1016da058%3F, 0x140003624e0%3F}, {0x1016df9c8, 0x14000254140}, {0x1016dae58, 0x140006f0720}, {0xa4091900%3F, 0xc14dda2c%3F})
	  completion.go:76  0x40c
golang.org/x/tools/gopls/internal/lsp.(*Server).completion(0x140002a0640%3F, {0x1016da058, 0x140003624e0}, 0x140002a0640)
	  completion.go:44  0x2d0
golang.org/x/tools/gopls/internal/lsp.(*Server).Completion(0x140001c2240%3F, {0x1016d9fb0%3F, 0x1400040e300%3F}, 0x10156d080%3F)
	  server_gen.go:28  0x28
golang.org/x/tools/gopls/internal/lsp/protocol.serverDispatch({0x1016d9fb0, 0x1400040e300}, {0x1016e28a0, 0x1400011a2d0}, 0x14000362180, {0x1016da2c0, 0x1400040e200})
	  tsserver.go:269  0x187c
golang.org/x/tools/gopls/internal/lsp/protocol.ServerHandler.func1({0x1016d9fb0, 0x1400040e300}, 0x14000362180, {0x1016da2c0, 0x1400040e200})
	  protocol.go:157  0x70
golang.org/x/tools/gopls/internal/lsp/lsprpc.handshaker.func1({0x1016d9fb0, 0x1400040e300}, 0x14000362180, {0x1016da2c0%3F, 0x1400040e200%3F})
	  lsprpc.go:521  0x788
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1({0x1016d9fb0, 0x1400040e300}, 0x140002850e0, {0x1016da2c0%3F, 0x1400040e200%3F})
	  handler.go:35  0xf4
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2()
	  handler.go:103  0x90
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
	  handler.go:100  0x1dc
[Error - 1:50:58 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>

@findleyr findleyr changed the title gopls: automated issue report (crash) x/tools/gopls: crash in filepath.Walk during go.work completion Nov 17, 2023
@findleyr
Copy link
Contributor

findleyr commented Nov 17, 2023

Thanks for the report!

Looks like the WalkFunc at that location needs to check for non-nil err and/or nil FileInfo.
We should reproduce first (chmod a file in a regtest?), and then fix.

This seems like a relatively rare occurrence, so I think this is fine to just fix in the next release.

Since this is a gopls issue, transferring to the Go issue tracker.

@findleyr findleyr transferred this issue from golang/vscode-go Nov 17, 2023
@findleyr findleyr added this to the gopls/v0.15.0 milestone Nov 17, 2023
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Nov 17, 2023
@findleyr findleyr self-assigned this Dec 15, 2023
@gopherbot
Copy link

Change https://go.dev/cl/550376 mentions this issue: gopls/internal/work: fix crash during go.work completion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants