-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: TestUseGoWork/experimental flaking with "no package for given file position" #53733
Comments
After much head scratching, I understand this flake now. There are many races when we allow building packages with invalid metadata, but I will summarize as follows:
I am skeptical of whether it is worth supporting this mode of using invalid metadata. go.dev/issues/42266 does not have too many details regarding what problem this solves. ...but in the meantime I will try simply making it impossible to add a package that does not match our current metadata for its package ID. I suspect that will make the flakes go away (and makes things more correct, after all). |
Change https://go.dev/cl/416224 mentions this issue: |
If metadata is refreshed during the execution of buildPackageHandle, we should not store the resulting package handle in the snapshot, as it breaks the invariant that computed packages match the currently loaded metadata. This strictness revealed another bug: because of our fine-grained locking in snapshot.load, it is possible that we set valid metadata multiple times, leading to unnecessary invalidation and potential further races to package handles. Fix this by building all metadata when processing the go/packages result, and only filtering updates after grabbing the lock. For golang/go#53733 Change-Id: Ib63ae4fbd97d0d25d45fe04f9bcd835996db41da Reviewed-on: https://go-review.googlesource.com/c/tools/+/416224 Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com> gopls-CI: kokoro <noreply+kokoro@google.com>
I think https://go.dev/cl/416224 will fix this bug, but since it introduces more assertions I'd like to wait and see that flakes are fully eliminated. |
So far so good: none since July 7.
|
Closing as I am fairly certain this is fixed. |
TestUseGoWork is flaking at master with "no package for given file position"
2022-07-06T19:31:10-d69bac6-3da88c0/linux-amd64-buster
2022-07-06T00:02:11-afa4a95-2007599/linux-amd64-unified
2022-07-04T04:09:44-698251a-3cf79d9/linux-amd64
2022-07-04T04:09:44-698251a-3cf79d9/linux-amd64-sid
2022-07-01T17:30:37-698251a-e822b1e/linux-amd64-longtest
This is definitely a gopls bug / race condition, albeit one that probably only manifests when
experimentalUseInvalidMetadata
is set. It is likely to have been a long-standing race, that was only exposed by CL 411913 (as explained in https://go-review.googlesource.com/c/tools/+/411913/comments/d750a369_d1c3110c).Somehow, due to racing loads, we're left in a state where package
a
depends on apackage b
that no longer exists.The text was updated successfully, but these errors were encountered: