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

Comments

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Sep 27, 2020

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
@stamblerre stamblerre added the Testing label Sep 27, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Sep 28, 2020

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

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
2 participants