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

Race condition in vstream_manager #8697

Closed
deepthi opened this issue Aug 26, 2021 · 2 comments
Closed

Race condition in vstream_manager #8697

deepthi opened this issue Aug 26, 2021 · 2 comments

Comments

@deepthi
Copy link
Member

deepthi commented Aug 26, 2021

Overview of the Issue

unit_test_race now consistently fails in #8696 with this trace

WARNING: DATA RACE
Write at 0x00c0088ed1b0 by goroutine 786:
  vitess.io/vitess/go/vt/vtgate.(*vstream).sendEvents.func4()
      /home/runner/work/vitess/vitess/go/vt/vtgate/vstream_manager.go:273 +0x64
  sync.(*Once).doSlow()
      /opt/hostedtoolcache/go/1.17.0/x64/src/sync/once.go:68 +0x127
  sync.(*Once).Do()
      /opt/hostedtoolcache/go/1.17.0/x64/src/sync/once.go:59 +0x46
  vitess.io/vitess/go/vt/vtgate.(*vstream).sendEvents()
      /home/runner/work/vitess/vitess/go/vt/vtgate/vstream_manager.go:272 +0x6be
  vitess.io/vitess/go/vt/vtgate.(*vstream).stream·dwrap·84()
      /home/runner/work/vitess/vitess/go/vt/vtgate/vstream_manager.go:232 +0x58

Previous read at 0x00c0088ed1b0 by goroutine 865:
  vitess.io/vitess/go/vt/vtgate.(*vstream).sendAll()
      /home/runner/work/vitess/vitess/go/vt/vtgate/vstream_manager.go:595 +0x18f
  vitess.io/vitess/go/vt/vtgate.(*vstream).streamFromTablet.func2()
      /home/runner/work/vitess/vitess/go/vt/vtgate/vstream_manager.go:517 +0x804
  vitess.io/vitess/go/vt/vttablet/sandboxconn.(*SandboxConn).VStream()
      /home/runner/work/vitess/vitess/go/vt/vttablet/sandboxconn/sandboxconn.go:486 +0x668
  vitess.io/vitess/go/vt/vtgate.(*vstream).streamFromTablet()
      /home/runner/work/vitess/vitess/go/vt/vtgate/vstream_manager.go:476 +0x1169
  vitess.io/vitess/go/vt/vtgate.(*vstream).startOneStream.func1()
      /home/runner/work/vitess/vitess/go/vt/vtgate/vstream_manager.go:306 +0xdb

Reproduction Steps

$ cd go/src/vitess.io/vitess/go/vt/vtgate
$ for i in {1..10}; do go test -timeout 2m -race; done

Binary version

Git revision 8b7a4cb branch 'main'

@deepthi
Copy link
Member Author

deepthi commented Aug 26, 2021

I attempted to fix this by synchronizing on vs.mu before writing to vs.err but that led to the tests hanging.
A more careful review of the code is required while implementing synchronization.

@deepthi
Copy link
Member Author

deepthi commented Aug 27, 2021

Fixed in #8696

@deepthi deepthi closed this as completed Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant