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/cmd/guru: find references results in high CPU on windows visual studio code #30298

Open
MelleKoning opened this issue Feb 18, 2019 · 7 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@MelleKoning
Copy link

go version go1.11.5 windows/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GOARCH=amd64

What did you do?

find all references on a method within Visual Studio Code, this executes guru.exe:

guru -referrers

This issue is also listed here:
microsoft/vscode-go#2084

Have tried updating guru.exe with the solution described here:
golang/tools#56 (comment)

Did not work. Eventually debugged and guru is parsing an entire tree by calling build.go from guru.go func importQueryPackage; that's where the high CPU load is occurring.

There is some code in build.go source code that uses slashes "/" for pathnames instead of os.PathSeparator, and wondering if that might be related to the issue?

You have to kill guru.exe process to put an end to its misery use of the CPU and memory, unfortunately.

What did you expect to see?

the referrals

What did you see instead?

high cpu and memory usage and Visual Studio Code is waiting for guru.exe to return with results, which does not happen.

@gopherbot gopherbot added this to the Unreleased milestone Feb 18, 2019
@agnivade agnivade changed the title x/tools/guru find references results in high CPU on windows visual studio code x/tools/cmd/guru: find references results in high CPU on windows visual studio code Feb 19, 2019
@agnivade
Copy link
Contributor

/cc @josharian @stamblerre

@agnivade agnivade added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 19, 2019
@josharian
Copy link
Contributor

Can you send a SIGQUIT signal to the process a few times and share the resulting stack traces?

@MelleKoning
Copy link
Author

Not sure how to do that in Windows 10 64 bit, I do have process explorer that tries to show a stacktrace but shows addresses and threads instead of actual methods/funcs from the stacktrace.

This one is by doing show all references on a method in guru itself, guessImportPath(...), which produces the following command line in Visual Studio Code:

C:\git\go\bin\guru.exe -modified referrers C:\git\go\src\golang.org\x\tools\cmd\guru\what.go:#5199

Process explorer shows

image

@MelleKoning
Copy link
Author

Ok, so what I notice is that with find references the entire gopath is being investigated; causes heavy disk usage and CPU. Thought that referrers would only search the currently active go project instead. Is there a reason the entire gopath is being analysed?

@MelleKoning
Copy link
Author

MelleKoning commented May 1, 2019

in what way could the /vendor folder be skipped for the 'find all references'?
I'm happy to apply a patch to guru myself but not entirely sure where in what.go a patch would help to accomplish this. The earlier patch by @doxxx only solves searching references on windows starts executing, but loading time is still huge. Therefore looking for quick local improvements...

@stamblerre
Copy link
Contributor

@MelleKoning: We are currently no longer making improvements to guru, as we are focusing efforts on gopls, which will ultimately support finding references. However, we would be happy to review CLs. I believe the change would need to skip vendor directories would need to be made in referrers.go. I'm not too familiar with this code, but it seems that referrers might already be ignoring vendor though? See here.

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Sep 12, 2019
@risentveber
Copy link

The same problem on Mac, see also fatih/vim-go#2509

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

6 participants