Skip to content

race in core/bazel #134

Description

@sywhang

There's a race in core/bazel w.r.t. stderr buffer streaming.

Running main test with -race repros this bug.

==================
WARNING: DATA RACE
Read at 0x00c0001e6270 by goroutine 22:
  bytes.(*Buffer).String()
      /opt/hostedtoolcache/go/1.24.5/x64/src/bytes/buffer.go:71 +0x124
  github.com/uber/tango/core/bazel.(*BazelClient).wrapQueryFailure()
      /home/runner/work/tango/tango/core/bazel/query.go:114 +0x100
  github.com/uber/tango/core/bazel.(*BazelClient).executeQueryInternal()
      /home/runner/work/tango/tango/core/bazel/query.go:98 +0xa67
  github.com/uber/tango/core/bazel.TestExecuteQueryInternal_ContextTimeout()
      /home/runner/work/tango/tango/core/bazel/query_test.go:171 +0xe64
  testing.tRunner()
      /opt/hostedtoolcache/go/1.24.5/x64/src/testing/testing.go:1792 +0x225
  testing.(*T).Run.gowrap1()
      /opt/hostedtoolcache/go/1.24.5/x64/src/testing/testing.go:1851 +0x44

Previous write at 0x00c0001e6270 by goroutine 27:
  bytes.(*Buffer).ReadFrom()
      /opt/hostedtoolcache/go/1.24.5/x64/src/bytes/buffer.go:216 +0x159
  io.copyBuffer()
      /opt/hostedtoolcache/go/1.24.5/x64/src/io/io.go:415 +0x21d
  io.Copy()
      /opt/hostedtoolcache/go/1.24.5/x64/src/io/io.go:388 +0x84
  github.com/uber/tango/core/bazel.streamOutput.func1()
      /home/runner/work/tango/tango/core/bazel/stream.go:29 +0x5a

Goroutine 22 (running) created at:
  testing.(*T).Run()
      /opt/hostedtoolcache/go/1.24.5/x64/src/testing/testing.go:1851 +0x8f2
  testing.runTests.func1()
      /opt/hostedtoolcache/go/1.24.5/x64/src/testing/testing.go:2279 +0x85
  testing.tRunner()
      /opt/hostedtoolcache/go/1.24.5/x64/src/testing/testing.go:1792 +0x225
  testing.runTests()
      /opt/hostedtoolcache/go/1.24.5/x64/src/testing/testing.go:2277 +0x96c
  testing.(*M).Run()
      /opt/hostedtoolcache/go/1.24.5/x64/src/testing/testing.go:2142 +0xeea
  main.main()
      _testmain.go:67 +0x164

Goroutine 27 (finished) created at:
  github.com/uber/tango/core/bazel.streamOutput()
      /home/runner/work/tango/tango/core/bazel/stream.go:28 +0x1c7
  github.com/uber/tango/core/bazel.(*BazelClient).executeQueryInternal.func2()
      /home/runner/work/tango/tango/core/bazel/query.go:93 +0xa4
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      /home/runner/go/pkg/mod/golang.org/x/sync@v0.16.0/errgroup/errgroup.go:93 +0x91
==================

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions