-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: format_on_save_new_file (govim) test flaky #36772
Comments
We also see instances of:
|
We also see instances of:
|
Going through the 3 log statements here: (1) I expect that this is logged by the initial workspace load and its attempt to run diagnostics on the workspace before all of files get created via (2) The second one I am unsure of, since it's a (3) I will mail a CL for this. |
Change https://golang.org/cl/216497 mentions this issue: |
Thanks. By way of response for (1):
But in this test, |
When the So it sounds like multiple processes are racing to modify |
Updates golang/go#36772 Change-Id: Id6f1be9511f37865d5c6efcff10230e03724b27d Reviewed-on: https://go-review.googlesource.com/c/tools/+/216497 Run-TryBot: Rebecca Stambler <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]>
Responding to (2)Thanks for the explanation, @jayconrod. For that test, it does seem like there is a race, between the initial workspace diagnostics and the This is a genuine error, so it should be logged. I'm a bit torn on how to handle it correctly - on one hand, it makes sense for all requests to wait on the initial workspace load to complete, but on the other hand, it's a better user experience if all language features work without any start-up delay. @heschik, what do you think? Responding to (1)
The log messages aren't necessarily in order, and diagnostics happen asynchronously so this isn't necessarily part of handling code actions. https://golang.org/cl/216497 added logging of snapshot IDs for diagnostics, so we can use that to confirm my suspicion that this log message happens during the initial workspace load. |
Change https://golang.org/cl/216543 mentions this issue: |
The go command gets mad if go.mod has changed since it started, e.g. because a new dependency was added by a concurrent go list call. Retry loads if they hit a concurrency problem. See the comment for more details. Testing this is awkward. I ran a background script that constantly modified the go.mod file and observed that gopls waited until it was killed and then recovered. Updates golang/go#36772. Change-Id: I5636c99a5a94b415c4a6fbb71869b07e31d3fed0 Reviewed-on: https://go-review.googlesource.com/c/tools/+/216543 Run-TryBot: Heschi Kreinick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]>
I believe that https://golang.org/cl/216637 will also deal with the errors that were logged in (1). Closing this issue as I believe all of the cases have been addressed. Please open a new issue if you see an unexpected error. |
Is it ok if we keep this open until that CL is merged and the issues are confirmed fixed? |
Change https://golang.org/cl/216637 mentions this issue: |
An update, testing against CL 216637: (1) - still seeing these, so I attach a passing and failing log with verbose enabled: Hopefully this gives you the snapshot information you now need? (2) what we can/should do in this case is actually fix the (3) we haven't seen any more instances of this. Thank you! (4) we have also started seeing an instance of:
|
Did my CL not fix (2)? |
(1) The log message occurs for snapshot 1, which is created by this
This error message therefore makes sense, since we weren't able to load anything about the package. I think that the flakiness here is related to timing - in the "pass" case, the diagnostics for snapshot 1 get canceled by the subsequent (4) I think this is similar to the cases that you are seeing in the other tests. It's again another valid error, so the real issue is figuring out what's causing this flakiness. |
If an orphaned file is used to recover a workspace package, we should remove the initialization error and treat the view as correctly initialized. Also, stop caching metadata for packages with no files. We have no way to invalidate it, and it's useless, so just re-load those files as needed. Fixes golang/go#36795. Fixes golang/go#36671. Fixes golang/go#36772. Change-Id: I0aee5a43401517b6073d27136cca533160effef2
(1) ah @stamblerre that sounds very plausible indeed. We should fix this on the (2) Didn't appear to, @heschik. We were testing against https://go-review.googlesource.com/c/tools/+/216637/4 (note, specific patchset). But that does appear to include your CL 216543. (4) understood, thanks. |
I don't know that you can assert against the errors for (1) one way or another. Depending on the context, the diagnostics may or may not be canceled. |
#36772 (comment): Okay. I don't understand how that's possible; I'll need another log to investigate further. |
Test the racing of gopls' usages of go/packages which result in racey usages of cmd/go modifying go.mod. More detail in: golang/go#36772 (comment) and preceding comments. The test below is an exact copy of the setup that triggered this failure. The go.mod is intentially "dirty" such that any calls to cmd/go will cause the require directive to be added. One such call happens in the initial workspace load, the other is triggered by GOVIMGoToDef if the initial call has not yet completed. Hence the two race to update go.mod
Test the racing of gopls' usages of go/packages which result in racey usages of cmd/go modifying go.mod. More detail in: golang/go#36772 (comment) and preceding comments. The test below is an exact copy of the setup that triggered this failure. The go.mod is intentially "dirty" such that any calls to cmd/go will cause the require directive to be added. One such call happens in the initial workspace load, the other is triggered by GOVIMGoToDef if the initial call has not yet completed. Hence the two race to update go.mod
Test the racing of gopls' usages of go/packages which result in racey usages of cmd/go modifying go.mod. More detail in: golang/go#36772 (comment) and preceding comments. The test below is an exact copy of the setup that triggered this failure. The go.mod is intentially "dirty" such that any calls to cmd/go will cause the require directive to be added. One such call happens in the initial workspace load, the other is triggered by GOVIMGoToDef if the initial call has not yet completed. Hence the two race to update go.mod
Test the racing of gopls' usages of go/packages which result in racey usages of cmd/go modifying go.mod. More detail in: golang/go#36772 (comment) and preceding comments. The test below is an exact copy of the setup that triggered this failure. The go.mod is intentially "dirty" such that any calls to cmd/go will cause the require directive to be added. One such call happens in the initial workspace load, the other is triggered by GOVIMGoToDef if the initial call has not yet completed. Hence the two race to update go.mod
Test the racing of gopls' usages of go/packages which result in racey usages of cmd/go modifying go.mod. More detail in: golang/go#36772 (comment) and preceding comments. The test below is an exact copy of the setup that triggered this failure. The go.mod is intentially "dirty" such that any calls to cmd/go will cause the require directive to be added. One such call happens in the initial workspace load, the other is triggered by GOVIMGoToDef if the initial call has not yet completed. Hence the two race to update go.mod
Test the racing of gopls' usages of go/packages which result in racey usages of cmd/go modifying go.mod. More detail in: golang/go#36772 (comment) and preceding comments. The test below is an exact copy of the setup that triggered this failure. The go.mod is intentially "dirty" such that any calls to cmd/go will cause the require directive to be added. One such call happens in the initial workspace load, the other is triggered by GOVIMGoToDef if the initial call has not yet completed. Hence the two race to update go.mod
Test the racing of gopls' usages of go/packages which result in racey usages of cmd/go modifying go.mod. More detail in: golang/go#36772 (comment) and preceding comments. The test below is an exact copy of the setup that triggered this failure. The go.mod is intentially "dirty" such that any calls to cmd/go will cause the require directive to be added. One such call happens in the initial workspace load, the other is triggered by GOVIMGoToDef if the initial call has not yet completed. Hence the two race to update go.mod
Test the racing of gopls' usages of go/packages which result in racey usages of cmd/go modifying go.mod. More detail in: golang/go#36772 (comment) and preceding comments. The test below is an exact copy of the setup that triggered this failure. The go.mod is intentially "dirty" such that any calls to cmd/go will cause the require directive to be added. One such call happens in the initial workspace load, the other is triggered by GOVIMGoToDef if the initial call has not yet completed. Hence the two race to update go.mod
Test the racing of gopls' usages of go/packages which result in racey usages of cmd/go modifying go.mod. More detail in: golang/go#36772 (comment) and preceding comments. The test below is an exact copy of the setup that triggered this failure. The go.mod is intentially "dirty" such that any calls to cmd/go will cause the require directive to be added. One such call happens in the initial workspace load, the other is triggered by GOVIMGoToDef if the initial call has not yet completed. Hence the two race to update go.mod
Test the racing of gopls' usages of go/packages which result in racey usages of cmd/go modifying go.mod. More detail in: golang/go#36772 (comment) and preceding comments. The test below is an exact copy of the setup that triggered this failure. The go.mod is intentially "dirty" such that any calls to cmd/go will cause the require directive to be added. One such call happens in the initial workspace load, the other is triggered by GOVIMGoToDef if the initial call has not yet completed. Hence the two race to update go.mod
…164 (#742) Test the racing of gopls' usages of go/packages which result in racey usages of cmd/go modifying go.mod. More detail in: golang/go#36772 (comment) and preceding comments. The test below is an exact copy of the setup that triggered this failure. The go.mod is intentially "dirty" such that any calls to cmd/go will cause the require directive to be added. One such call happens in the initial workspace load, the other is triggered by GOVIMGoToDef if the initial call has not yet completed. Hence the two race to update go.mod
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
As a follow up to #34103 (comment), we are seeing some errors being logged by
gopls
when we are not expecting any.As background, in govim/govim#661 we are looking to enable an automatic check at the end of each integration test, a check that asserts we have received no errors/warnings from
gopls
(this check will not be in place for tests where we are expecting errors/warnings).For example we have a test that ensures
CodeAction
andFormatting
work on a buffer that does not yet exist on disk.In the test we sometimes see the following error message:
The
gopls
log file for this test run is: gopls.logIt is true that no files exist, but this test is run within the context of a main module.
What did you expect to see?
No errors logged.
What did you see instead?
As above.
Tentatively marking as
v0.3.0
. I will also add further instances of logged errors as CI finds them.cc @stamblerre
FYI @leitzler
The text was updated successfully, but these errors were encountered: