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: Slow Startup With Cache #48829

Closed
mattdee123 opened this issue Oct 6, 2021 · 1 comment
Closed

x/tools/gopls: Slow Startup With Cache #48829

mattdee123 opened this issue Oct 6, 2021 · 1 comment
Labels
FrozenDueToAge 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

@mattdee123
Copy link

What did you do?

I use gopls through vim-go. I frequently open and close vim windows, and, on a large repo, it takes a while until gopls is useable. I would expect this when the gopls daemon is first started, but there is a slow startup every time I run vim, despite the new instance of vim using the same daemon.

Recipe to replicate:

  1. Obtain a large Go codebase. I used this script to generate one with 2047 packages.
  2. Configure vim-go by adding the following to .vimrc: let g:go_gopls_options = ['-debug=:0', '-remote=unix;/tmp/gopls-daemon-socket', '-logfile=auto', '-rpc.trace']
  3. Start daemon with gopls -listen="unix;/tmp/gopls-daemon-socket" -logfile=auto -rpc.trace -debug=:0
  4. In a new terminal, open a go file in vim, immediately try to jump to a definition. On my computer, this took over 10 seconds. Subsequent jumps were instantaneous.
  5. In another new terminal, repeat step 4. Again, it took over 10 seconds before gopls was available.

What did you expect to see?

I expected the first vim instance to take a while to start up, but I expected the second vim instance to be responsive right away, since the daemon's cache was warm.

What did you see instead?

The second instance of vim also took a long time before gopls was available.

Logs are below:

client1.log
client2.log
daemon.log

Additionally, the debug http server showed that both clients were, indeed, using the same cache.

Screen Shot 2021-10-06 at 2 34 08 PM

Build info

golang.org/x/tools/gopls v0.7.2
    golang.org/x/tools/gopls@v0.7.2 h1:kRKKdvA8GOzra8rhSFDClOR7hV/x8v0J0Vm4C/gWq8s=
    github.com/BurntSushi/toml@v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw=
    github.com/google/go-cmp@v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
    github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/mod@v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
    golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
    golang.org/x/sys@v0.0.0-20210809222454-d867a43fc93e h1:WUoyKPm6nCo1BnNUvPGnFG3T5DUVem42yDJZZ4CNxMA=
    golang.org/x/tools@v0.1.6-0.20210908190839-cf92b39a962c h1:C0nyHiBU2m0cR6hDiUORWqQIt3h37wsp1255QBSSXqY=
    golang.org/x/xerrors@v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
    honnef.co/go/tools@v0.2.0 h1:ws8AfbgTX3oIczLPNPCu5166oBg9ST2vNs0rcht+mDE=
    mvdan.cc/gofumpt@v0.1.1 h1:bi/1aS/5W00E2ny5q65w9SnKpWEF/UIOqDYBILpo9rA=
    mvdan.cc/xurls/v2@v2.3.0 h1:59Olnbt67UKpxF1EwVBopJvkSUBmgtb468E4GVWIZ1I=
@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 Oct 6, 2021
@gopherbot gopherbot added this to the Unreleased milestone Oct 6, 2021
@mattdee123
Copy link
Author

sorry, I accidentally duplicated this report. see #48829

@golang golang locked and limited conversation to collaborators Oct 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge 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

2 participants