-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Run-TryBot: Bryan C. Mills <[email protected]> gopls-CI: kokoro <[email protected]> Reviewed-by: Robert Findley <[email protected]> TryBot-Result: Go Bot <[email protected]>
- Loading branch information
Bryan C. Mills
committed
Dec 2, 2021
1 parent
2ac48c6
commit e212aff
Showing
4 changed files
with
44 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters