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
Milestone

Comments

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Jan 22, 2020

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
@stamblerre

This comment has been minimized.

Copy link
Contributor Author

@stamblerre stamblerre commented Jan 22, 2020

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
@heschik

This comment has been minimized.

Copy link
Contributor

@heschik heschik commented Jan 23, 2020

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

@stamblerre

This comment has been minimized.

Copy link
Contributor Author

@stamblerre stamblerre commented Jan 23, 2020

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

This comment has been minimized.

Copy link

@zikaeroh zikaeroh commented Jan 29, 2020

#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

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jan 29, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.