go/internal/lsp/cache
Bryan C. Mills e212aff8fd internal/memoize: do not allow (*Generation).Acquire to fail
The Acquire method is nearly instantaneous; it only potentially blocks
on a small, constant sequence of cache misses, so there is no need to
avoid blocking in it when a Context is cancelled.

An early return when the passed-in Context is canceled was added in CL
242838 to avoid incrementing the Generation's WaitGroup after its
destruction has begun; however, that early return also bypasses the
WaitGroup accounting that blocks Destroy while the generation is still
in use. Instead, we need the invariant that Acquire is not called in
the first place after Destroy, which we can ensure by nilling out
the View's snapshot when we begin destroying it.

I was not able to reproduce golang/go#48774 locally, but I believe
that this CL will fix it. (It may, however, expose other races or
deadlocks that may have been masked by the early return, which we can
then fix separately.)

Fixes golang/go#48774

Change-Id: Iac36fceb06485f849da5ba0250b44b55f937c44b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/367675
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-12-02 03:25:35 +00:00
..
analysis.go internal/lsp/cache: keep going on failed analyzers 2021-09-22 22:01:15 +00:00
cache.go internal/lsp: export and move some objects related to metadata 2021-08-15 15:51:49 +00:00
check.go internal/typeparams: update to the new Instances API 2021-09-21 18:37:00 +00:00
error_test.go internal/lsp/cache: split up sourceDiagnostics 2021-03-02 02:05:13 +00:00
errors.go internal/lsp/cache: fix incorrect detection of useless code 2021-10-14 14:04:14 +00:00
imports.go internal/memoize: do not allow (*Generation).Acquire to fail 2021-12-02 03:25:35 +00:00
keys.go internal/lsp: decouple client and server debug 2020-06-11 13:49:48 +00:00
load.go internal/lsp/cache: fix flakiness of load progress reports 2021-08-17 14:56:21 +00:00
metadata.go internal/lsp: export and move some objects related to metadata 2021-08-15 15:51:49 +00:00
mod.go internal/lsp: fix support for SourceFixAll code actions 2021-03-24 23:51:27 +00:00
mod_tidy.go internal/lsp: remove unnecessary call to WorkspacePackages in mod tidy 2021-03-30 04:13:47 +00:00
os_darwin.go internal/lsp/cache: clarify an error message about mismatching casing 2021-08-03 17:18:10 +00:00
os_windows.go internal/lsp/cache: clarify an error message about mismatching casing 2021-08-03 17:18:10 +00:00
parse.go internal/lsp/cache: don't offset invalid positions 2021-11-05 15:19:55 +00:00
parse_test.go internal/lsp/cache: trim more stuff in ParseExported mode 2021-05-11 17:48:41 +00:00
pkg.go internal/lsp/cache: don't offset invalid positions 2021-11-05 15:19:55 +00:00
session.go internal/memoize: do not allow (*Generation).Acquire to fail 2021-12-02 03:25:35 +00:00
snapshot.go gopls: template suffix flags and documentation 2021-11-23 16:39:20 +00:00
symbols.go internal/lsp: precompute workspace symbols 2021-08-09 20:20:17 +00:00
view.go internal/memoize: do not allow (*Generation).Acquire to fail 2021-12-02 03:25:35 +00:00
view_test.go internal/lsp: enable template processing and add templateFiles option 2021-11-10 16:35:53 +00:00
workspace.go internal/lsp: support go.work outside of experimental 2021-09-29 19:20:39 +00:00
workspace_test.go internal/lsp: start parsing go.work file like gopls.mod file 2021-06-24 04:20:31 +00:00