Skip to content

x/tools/gopls: symbolic link to / causes ModuleResolver to scan entire file system, burning CPU #74686

@rata

Description

@rata

What did you do?

Clone https://github.com/opencontainers/runc/ and do this:

cd runc
ln -s / gopls-cpu-high

Then open any file in the project and wait 1-3 minutes.

For example, I used:

vim libcontainer/rootfs_linux.go

This should work with any go project that you add the symlink to.

What did you expect to see?

gopls doesn't use 2000% of cpu continously .

I'm not 100% sure gopls can handle this situation nor if it makes sense to do it. I'm mostly reporting it because it took me some hours to figure out (I had a lot of files not tracked and that symlink was a mistake). I'm fine if you want to close as won't fix :-)

What did you see instead?

gopls uses 2000% of the cpu continously.

Build info

golang.org/x/tools/gopls v0.19.1
    golang.org/x/tools/[email protected] h1:Yodhp3rnpnag60lVZrYPYbGMxTlTCIAj/B2Rv7AKuhA=
    github.com/BurntSushi/[email protected] h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs=
    github.com/fatih/[email protected] h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8=
    github.com/fatih/[email protected] h1:dDSgAjoOMp8da3egfz0t2S+t8RGOpEmEXZubcGuc0Bg=
    github.com/fatih/[email protected] h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
    github.com/google/[email protected] h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
    golang.org/x/exp/[email protected] h1:Br3+0EZZohShrmVVc85znGpxw7Ca8hsUJlrdT/JQGw8=
    golang.org/x/[email protected] h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w=
    golang.org/x/[email protected] h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
    golang.org/x/[email protected] h1:RXY2+rSHXvxO2Y+gKrPjYVaEoGOqh3VEXFhnWAt1Irg=
    golang.org/x/[email protected] h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
    golang.org/x/[email protected] h1:XnjOegqwH6kBJoae6InSGbIFPHcLtUT/Eq8HjrZKbmQ=
    golang.org/x/[email protected] h1:Ju8QsuyhX3Hk8ma3CesTbO8vfJD9EvUBgHvkxHBzj0I=
    honnef.co/go/[email protected] h1:fj8r9irJSpolAGUdZBxJIRY3lLc4jH2Dt4lwnWyWwpw=
    mvdan.cc/[email protected] h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU=
    mvdan.cc/xurls/[email protected] h1:3NTZpeTxYVWNSokW3MKeyVkz/j7uYXYiMtXRUfmjbgI=
go: go1.24.4

Metadata

Metadata

Assignees

Labels

ToolsThis 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

Issue actions