Skip to content

x/tools/gopls: recursive orphaned file reloading #59318

Closed
@findleyr

Description

@findleyr

While investigating #59184, I found what I think may be a long-standing bug in gopls that potentially explains many user reports (such as #54007).

Therefore, if orphaned file reloading tries to load N files, it will call go/packages once with N file= queries, which invokes go list N times. The load will succeed, because it produces at least one package, but only one command-line-arguments package will be recorded. The next time orphaned file reloading occurs, it will retry with N-1 files.

I.e. orphaned reloading involves N^2 go list invocations...

CC @adonovan

Activity

added
gopls/performanceIssues related to gopls performance (CPU, memory, etc).
gopls/metadataIssues related to metadata loading in gopls
on Mar 29, 2023
added this to the gopls/v0.12.0 milestone on Mar 29, 2023
added
ToolsThis label describes issues relating to any tools in the x/tools repository.
goplsIssues related to the Go language server, gopls.
on Mar 29, 2023
gopherbot

gopherbot commented on Mar 29, 2023

@gopherbot
Contributor

Change https://go.dev/cl/480197 mentions this issue: gopls/internal/lsp/cache: record unloadable files if loading completes

gopherbot

gopherbot commented on May 11, 2023

@gopherbot
Contributor

Change https://go.dev/cl/494401 mentions this issue: internal/lsp/cache: support loading multiple orphaned files

added a commit that references this issue on Feb 16, 2024
cd39d2b
locked and limited conversation to collaborators on May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.gopls/metadataIssues related to metadata loading in goplsgopls/performanceIssues related to gopls performance (CPU, memory, etc).

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @gopherbot@findleyr

        Issue actions

          x/tools/gopls: recursive orphaned file reloading · Issue #59318 · golang/go