New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/tools/gopls: TestCommandLine failing frequently with duplicate references #53796
Comments
Change https://go.dev/cl/416877 mentions this issue: |
Change https://go.dev/cl/416879 mentions this issue: |
This reverts commit 42457a5. Reason for revert: test flakes (golang/go#53796) Change-Id: I9d7061220b43f9de88060a0bba5c5635d92fe3d9 Reviewed-on: https://go-review.googlesource.com/c/tools/+/416879 Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
CC @adonovan Decided to revert CL 416874 as the root cause was initially opaque: how could a change relating to imports ProcessEnv cause failures in GOPATH command-line tests?! But thinking about this a bit more, I believe I have a likely hypothesis:
So the test failure can be the result of snapshot shutdown actually working properly... note that while the test runner delays shutdown until the end, unfortunately the lsprpc package issues a shutdown itself. |
Change https://go.dev/cl/416881 mentions this issue: |
Does the second test happen after the first one completes shutdown? Or is the point that shutdown is asynchronous and therefore the second test races with cache eviction? There is something to be said for relying more heavily on integration testing of the executable through its user interface (i.e. the LSP service). They may be slower to start up but such tests tend to exhibit fewer artifacts of the testing framework. And slow startup can usually be fixed. |
We were already using a token.File-agnostic position for object positions in our references algorithm, but still relied on token.Pos for identifying duplicate references. This breaks down when a file may have multiple parsed representations in different packages. While we should endeavor to eliminate duplicate parsing, our algorithms should not rely on this for correctness. Update the reference de-duplication to use the same position key as object search. For golang/go#53796 Change-Id: Ic2e6c23380ea4e6b2747e4e5b45d7bfa6e656f0f Reviewed-on: https://go-review.googlesource.com/c/tools/+/416881 Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com>
…rtsState" This reverts CL 416879, which itself was a revert of CL 416874. Reason for revert: failure is understood now, as described in golang/go#53796 (comment) and fixed in CL 416881. Change-Id: I1d6a4ae46fbb1bf78e2f23656de7885b439f43fb Reviewed-on: https://go-review.googlesource.com/c/tools/+/416882 Reviewed-by: Alan Donovan <adonovan@google.com> Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Shutdown is asynchronous: the test closes the connection and the server is configured to asynchronously clean up resources, even if the test runner does not issue the 'shutdown' RPC. So the cache eviction races with the next test. We could improve this, but fundamentally the cache should only be an optimization, and should not affect correctness. https://go.dev/cl/416881 fixes the correctness bug. Closing this issue as the fundamental problem is fixed. |
Many test flakes since https://go.dev/cl/416874. Investigating briefly to see if rolling back can be avoided.
The text was updated successfully, but these errors were encountered: