Skip to content
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: race in updateAnalyzers #36699

Closed
stamblerre opened this issue Jan 22, 2020 · 5 comments
Closed

x/tools/gopls: race in updateAnalyzers #36699

stamblerre opened this issue Jan 22, 2020 · 5 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@stamblerre
Copy link
Contributor

Seen on CL 215743, which was not related.

This is specific to the tests in golang.org/x/tools/gopls/test, because they pass an options modification function (with the signature func(*source.Options)) that updates the analyzers map. All of the command tests use this type of function, but only the gopls/test ones modify a map. A possible solution would be to have a mutex on the options before modifying them.

@stamblerre stamblerre added this to the gopls/v0.3.0 milestone Jan 22, 2020
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Jan 22, 2020
@stamblerre
Copy link
Contributor Author

I'm actually not sure how to fix this effectively since all of the fields in the options are exported.
@heschik, @ianthehat: Do you have any suggestions here?

@stamblerre stamblerre modified the milestones: gopls/v0.3.0, gopls/v1.0.0 Jan 22, 2020
@heschi
Copy link
Contributor

heschi commented Jan 23, 2020

I set GORACE=history_size=7 and had no luck getting the other side of the race.

@stamblerre
Copy link
Contributor Author

After offline discussion with @ianthehat, @heschik will look into the possibility of setting GORACE=history_size to a much higher value so that we can see where the previous write is.

@zikaeroh
Copy link
Contributor

#36872's logs actually show the other side of the race:

Previous read at 0x00c0001ce168 by goroutine 911:
  golang.org/x/tools/internal/lsp/source.analyses()
      /tmp/workdir/gopath/src/golang.org/x/tools/internal/lsp/source/diagnostics.go:183 +0x174
  golang.org/x/tools/internal/lsp/source.Diagnostics()
      /tmp/workdir/gopath/src/golang.org/x/tools/internal/lsp/source/diagnostics.go:91 +0x739
  golang.org/x/tools/internal/lsp.(*Server).diagnose.func1.1()
      /tmp/workdir/gopath/src/golang.org/x/tools/internal/lsp/diagnostics.go:58 +0x1cb

@gopherbot
Copy link

Change https://golang.org/cl/216844 mentions this issue: internal/lsp/source: check cancellation before analysis

@stamblerre stamblerre modified the milestones: gopls/v1.0.0, gopls/v0.4.0 Jul 22, 2020
@golang golang locked and limited conversation to collaborators Jul 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants