go/internal
Robert Findley 98bfcd1bee internal/memoize: fix race in Store.Promise
When releasing a promise, there was a theoretical race whereby a
promise's refcount could be incremented before Store.promisesMu was
acquired and the promise deleted.

We could fix this by double-checking after acquiring Store.promisesMu,
but it seemed simpler to just guard Promise.refcount with
Store.promisesMu, and skip using atomics. We already lock promisesMu
when acquiring the promise, and so locking when releasing should not
significantly affect our level of contention.

Additionally, make it a panic to call the returned release function more
than once, and document this behavior.

Change-Id: I1135b558b1f13f2b063dcaad129a432c22da0b28
Reviewed-on: https://go-review.googlesource.com/c/tools/+/419504
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-07-28 15:35:11 +00:00
..
analysisinternal internal/analysisinternal: move FindBestMatch to internal/lsp/fuzzy 2022-07-13 21:41:37 +00:00
apidiff all: gofmt 2022-04-12 17:53:17 +00:00
event all: gofmt 2022-04-12 17:53:17 +00:00
fakenet
fastwalk all: gofmt 2022-04-12 17:53:17 +00:00
gocommand internal/gocommand: skip ill-formed env vars in cmdDebugStr 2022-05-25 15:29:25 +00:00
gopathwalk internal/gopathwalk: remove unnecessary call to os.Lstat 2022-03-31 05:33:07 +00:00
imports internal/imports: use a module resolver if GOWORK is set 2022-06-24 21:03:09 +00:00
jsonrpc2 internal/lsp/regtest: don't run the connection on the test context 2022-06-10 12:48:42 +00:00
jsonrpc2_v2 internal/jsonrpc2*: remove usage of golang.org/x/xerrors 2022-04-20 16:10:40 +00:00
lsp internal/lsp/cache: allow network whenever reloading the workspace 2022-07-27 19:28:51 +00:00
memoize internal/memoize: fix race in Store.Promise 2022-07-28 15:35:11 +00:00
packagesinternal x/tools/go/packages: on Go 1.19+, explicitly ask for -json fields needed 2022-04-19 17:08:06 +00:00
persistent internal/lsp/cache: use GetHandle not Bind for 5 URI-keyed maps 2022-07-07 16:57:02 +00:00
proxydir
span internal/span: fix incorrect bounds check in ToOffset 2022-07-25 14:31:12 +00:00
stack all: gofmt 2022-04-12 17:53:17 +00:00
testenv internal: remove pre-go1.12 conditionally compiled files 2022-05-05 16:48:28 +00:00
tool internal/tool: implement structured help command 2022-05-04 22:58:41 +00:00
typeparams Revert "internal: temporarily disable tests so we can land CL 410955" 2022-06-08 01:09:07 +00:00
typesinternal internal/typesinternal: update typesinternal for 1.18 2022-02-22 16:42:18 +00:00
xcontext