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 detected when running regression tests #41653

Closed
stamblerre opened this issue Sep 27, 2020 · 1 comment
Closed

x/tools/gopls: race detected when running regression tests #41653

stamblerre opened this issue Sep 27, 2020 · 1 comment
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Testing An issue that has been verified to require only test changes, not just a test failure. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@stamblerre
Copy link
Contributor

I noticed a race when running the regression tests at master.

go test ./internal/regtest/ -run=TestCreateModule_Interdependent/forwarded -v -count=40 -race will lead to this result:

==================
WARNING: DATA RACE
Read at 0x00c00002d2a0 by goroutine 41:
  internal/race.ReadRange()
      /usr/local/go/src/internal/race/race.go:45 +0xb0
  syscall.Write()
      /usr/local/go/src/syscall/syscall_unix.go:215 +0x94
  internal/poll.ignoringEINTR()
      /usr/local/go/src/internal/poll/fd_unix.go:567 +0x62
  internal/poll.(*FD).Write()
      /usr/local/go/src/internal/poll/fd_unix.go:267 +0x20e
  os.(*File).write()
      /usr/local/go/src/os/file_posix.go:48 +0xb1
  os.(*File).Write()
      /usr/local/go/src/os/file.go:173 +0x6b
  bytes.(*Buffer).WriteTo()
      /usr/local/go/src/bytes/buffer.go:239 +0x1e7
  io.copyBuffer()
      /usr/local/go/src/io/io.go:391 +0x482
  io.Copy()
      /usr/local/go/src/io/io.go:368 +0x124
  golang.org/x/tools/gopls/internal/regtest.(*loggingFramer).printBuffers()
      /Users/rstambler/code/src/golang.org/x/tools/gopls/internal/regtest/runner.go:313 +0xdf
  golang.org/x/tools/gopls/internal/regtest.(*Runner).Run.func1.1()
      /Users/rstambler/code/src/golang.org/x/tools/gopls/internal/regtest/runner.go:280 +0xe4
  golang.org/x/tools/gopls/internal/regtest.(*Runner).Run.func1()
      /Users/rstambler/code/src/golang.org/x/tools/gopls/internal/regtest/runner.go:285 +0x8a2
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1108 +0x202

Previous write at 0x00c00002d2a7 by goroutine 105:
  runtime.slicecopy()
      /usr/local/go/src/runtime/slice.go:246 +0x0
  bytes.(*Buffer).Write()
      /usr/local/go/src/bytes/buffer.go:174 +0x147
  golang.org/x/tools/internal/lsp/protocol.(*loggingStream).logCommon()
      /Users/rstambler/code/src/golang.org/x/tools/internal/lsp/protocol/log.go:131 +0xa15
  golang.org/x/tools/internal/lsp/protocol.(*loggingStream).Write()
      /Users/rstambler/code/src/golang.org/x/tools/internal/lsp/protocol/log.go:34 +0x5b
  golang.org/x/tools/internal/jsonrpc2.(*conn).write()
      /Users/rstambler/code/src/golang.org/x/tools/internal/jsonrpc2/conn.go:185 +0x117
  golang.org/x/tools/internal/jsonrpc2.(*conn).replier.func1()
      /Users/rstambler/code/src/golang.org/x/tools/internal/jsonrpc2/conn.go:171 +0x1e4
  golang.org/x/tools/internal/lsp/protocol.CancelHandler.func1.1()
      /Users/rstambler/code/src/golang.org/x/tools/internal/lsp/protocol/protocol.go:101 +0x119
  golang.org/x/tools/internal/jsonrpc2.CancelHandler.func1.1()
      /Users/rstambler/code/src/golang.org/x/tools/internal/jsonrpc2/handler.go:66 +0x141
  golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.1()
      /Users/rstambler/code/src/golang.org/x/tools/internal/jsonrpc2/handler.go:97 +0x9c
  golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1.1()
      /Users/rstambler/code/src/golang.org/x/tools/internal/jsonrpc2/handler.go:40 +0xed
  golang.org/x/tools/internal/lsp/protocol.clientDispatch()
      /Users/rstambler/code/src/golang.org/x/tools/internal/lsp/protocol/tsclient.go:89 +0x1aac
  golang.org/x/tools/internal/lsp/protocol.ClientHandler.func1()
      /Users/rstambler/code/src/golang.org/x/tools/internal/lsp/protocol/protocol.go:49 +0xef
  golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1()
      /Users/rstambler/code/src/golang.org/x/tools/internal/jsonrpc2/handler.go:35 +0x189
  golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2()
      /Users/rstambler/code/src/golang.org/x/tools/internal/jsonrpc2/handler.go:103 +0x93

Goroutine 41 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1159 +0x796
  golang.org/x/tools/gopls/internal/regtest.(*Runner).Run()
      /Users/rstambler/code/src/golang.org/x/tools/gopls/internal/regtest/runner.go:239 +0x604
  golang.org/x/tools/gopls/internal/regtest.configuredRunner.run()
      /Users/rstambler/code/src/golang.org/x/tools/gopls/internal/regtest/reg_test.go:44 +0xcb
  golang.org/x/tools/gopls/internal/regtest.TestCreateModule_Interdependent()
      /Users/rstambler/code/src/golang.org/x/tools/gopls/internal/regtest/workspace_test.go:286 +0x64
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1108 +0x202

Goroutine 105 (running) created at:
  golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1()
      /Users/rstambler/code/src/golang.org/x/tools/internal/jsonrpc2/handler.go:100 +0x23b
  golang.org/x/tools/internal/jsonrpc2.CancelHandler.func1()
      /Users/rstambler/code/src/golang.org/x/tools/internal/jsonrpc2/handler.go:69 +0x2cc
  golang.org/x/tools/internal/lsp/protocol.CancelHandler.func1()
      /Users/rstambler/code/src/golang.org/x/tools/internal/lsp/protocol/protocol.go:103 +0x12a
  golang.org/x/tools/internal/jsonrpc2.(*conn).run()
      /Users/rstambler/code/src/golang.org/x/tools/internal/jsonrpc2/conn.go:218 +0x90e
==================
#### End Gopls Test Logs 2 of 2 for "TestCreateModule_Interdependent/forwarded"
    testing.go:1023: race detected during execution of test
=== CONT  TestCreateModule_Interdependent
    testing.go:1023: race detected during execution of test
--- FAIL: TestCreateModule_Interdependent (0.98s)
    --- FAIL: TestCreateModule_Interdependent/forwarded (0.98s)
=== CONT  
    testing.go:1023: race detected during execution of test

We should try to fix this ASAP, because it makes it difficult to debug other races (as in https://golang.org/cl/257417).

/cc @findleyr

@stamblerre stamblerre added this to the gopls/v1.0.0 milestone Sep 27, 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 Sep 27, 2020
@stamblerre stamblerre added the Testing An issue that has been verified to require only test changes, not just a test failure. label Sep 27, 2020
@gopherbot
Copy link

Change https://golang.org/cl/257957 mentions this issue: gopls/internal/regtest: fix data race when printing logs

@stamblerre stamblerre modified the milestones: gopls/v1.0.0, gopls/v0.5.2 Oct 5, 2020
@golang golang locked and limited conversation to collaborators Oct 5, 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. Testing An issue that has been verified to require only test changes, not just a test failure. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

2 participants