diff options
author | Robert Findley <rfindley@google.com> | 2022-06-26 15:17:46 -0400 |
---|---|---|
committer | Robert Findley <rfindley@google.com> | 2022-06-27 16:29:48 +0000 |
commit | 56116ec0159179782987cb761912b6fd3fa997ee (patch) | |
tree | 2ec9c7f1f48ec65a1029b21570ea81070f30530b /internal/lsp/cache/parse.go | |
parent | 10494c735e6ba5ec3a5eed252fc61a116a21a31d (diff) | |
download | golang-x-tools-56116ec0159179782987cb761912b6fd3fa997ee.tar.gz |
internal/memoize: don't destroy reference counted handles
Unlike generational handles, when reference counted handles are evicted
from the Store we don't know that they are also no longer in use by
active goroutines. Destroying them causes goroutine leaks.
Also fix a data race because Handle.mu was not acquired in the release
func returned by GetHandle.
Change-Id: Ida7bb6961a035dd24ef8566c7e4faa6890296b5b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/414455
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'internal/lsp/cache/parse.go')
-rw-r--r-- | internal/lsp/cache/parse.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/lsp/cache/parse.go b/internal/lsp/cache/parse.go index 376524bd3..f7b4f9c70 100644 --- a/internal/lsp/cache/parse.go +++ b/internal/lsp/cache/parse.go @@ -61,7 +61,7 @@ func (s *snapshot) parseGoHandle(ctx context.Context, fh source.FileHandle, mode parseHandle, release := s.generation.GetHandle(key, func(ctx context.Context, arg memoize.Arg) interface{} { snapshot := arg.(*snapshot) return parseGo(ctx, snapshot.FileSet(), fh, mode) - }, nil) + }) pgh := &parseGoHandle{ handle: parseHandle, |