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

Data race in lockset_test.go #1018

Open
bobvawter opened this issue Sep 19, 2024 · 0 comments
Open

Data race in lockset_test.go #1018

bobvawter opened this issue Sep 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@bobvawter
Copy link
Member

The test itself has a race condition.

==================
WARNING: DATA RACE
Read at 0x00c0000be098 by goroutine 1041:
  github.com/cockroachdb/replicator/internal/util/lockset.TestSmoke()
      /home/runner/work/replicator/replicator/internal/util/lockset/lockset_test.go:165 +0x750
  testing.tRunner()
      /opt/hostedtoolcache/go/1.22.6/x64/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /opt/hostedtoolcache/go/1.22.6/x64/src/testing/testing.go:1742 +0x44

Previous write at 0x00c0000be098 by goroutine 1280:
  github.com/cockroachdb/replicator/internal/util/lockset.TestSmoke.func1()
      /home/runner/work/replicator/replicator/internal/util/lockset/lockset_test.go:90 +0x2bb
  github.com/cockroachdb/replicator/internal/util/lockset.TestSmoke.func2.1()
      /home/runner/work/replicator/replicator/internal/util/lockset/lockset_test.go:155 +0x6c
  github.com/cockroachdb/replicator/internal/util/lockset.tryCall[go.shape.int]()
      /home/runner/work/replicator/replicator/internal/util/lockset/lockset.go:409 +0x14c
  github.com/cockroachdb/replicator/internal/util/lockset.(*Set[go.shape.int]).dispose.func1()
      /home/runner/work/replicator/replicator/internal/util/lockset/lockset.go:295 +0x32e
  github.com/cockroachdb/field-eng-powertools/workgroup.(*Group).worker()
      /home/runner/go/pkg/mod/github.com/cockroachdb/field-eng-powertools@v0.0.0-20240829142217-c680a7021280/workgroup/workgroup.go:149 +0x3ea
  github.com/cockroachdb/field-eng-powertools/workgroup.(*Group).maybeStart.gowrap2()
      /home/runner/go/pkg/mod/github.com/cockroachdb/field-eng-powertools@v0.0.0-20240829142217-c680a7021280/workgroup/workgroup.go:113 +0x5d

Goroutine 1041 (running) created at:
  testing.(*T).Run()
      /opt/hostedtoolcache/go/1.22.6/x64/src/testing/testing.go:1742 +0x825
  testing.runTests.func1()
      /opt/hostedtoolcache/go/1.22.6/x64/src/testing/testing.go:2161 +0x85
  testing.tRunner()
      /opt/hostedtoolcache/go/1.22.6/x64/src/testing/testing.go:1689 +0x21e
  testing.runTests()
      /opt/hostedtoolcache/go/1.22.6/x64/src/testing/testing.go:2159 +0x8be
  testing.(*M).Run()
      /opt/hostedtoolcache/go/1.22.6/x64/src/testing/testing.go:2027 +0xf17
  main.main()
      _testmain.go:105 +0x2e4

Goroutine 1280 (finished) created at:
  github.com/cockroachdb/field-eng-powertools/workgroup.(*Group).maybeStart()
      /home/runner/go/pkg/mod/github.com/cockroachdb/field-eng-powertools@v0.0.0-20240829142217-c680a7021280/workgroup/workgroup.go:113 +0x24f
  github.com/cockroachdb/field-eng-powertools/workgroup.(*Group).Go()
      /home/runner/go/pkg/mod/github.com/cockroachdb/field-eng-powertools@v0.0.0-20240829142217-c680a7021280/workgroup/workgroup.go:78 +0xaf
  github.com/cockroachdb/replicator/internal/util/lockset.(*Set[go.shape.int]).dispose()
      /home/runner/work/replicator/replicator/internal/util/lockset/lockset.go:367 +0x1c1
  github.com/cockroachdb/replicator/internal/util/lockset.(*Set[go.shape.int]).Schedule()
      /home/runner/work/replicator/replicator/internal/util/lockset/lockset.go:248 +0x7e7
  github.com/cockroachdb/replicator/internal/util/lockset.TestSmoke.func2()
      /home/runner/work/replicator/replicator/internal/util/lockset/lockset_test.go:155 +0x7b3
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      /home/runner/go/pkg/mod/golang.org/x/sync@v0.8.0/errgroup/errgroup.go:78 +0x91
==================
==================
WARNING: DATA RACE
Read at 0x00c000536b90 by goroutine 1041:
  reflect.Value.Int()
      /opt/hostedtoolcache/go/1.22.6/x64/src/reflect/value.go:1467 +0x664
  reflect.deepValueEqual()
      /opt/hostedtoolcache/go/1.22.6/x64/src/reflect/deepequal.go:161 +0x4f2
  reflect.deepValueEqual()
      /opt/hostedtoolcache/go/1.22.6/x64/src/reflect/deepequal.go:113 +0x1f69
  reflect.DeepEqual()
      /opt/hostedtoolcache/go/1.22.6/x64/src/reflect/deepequal.go:238 +0x244
  github.com/stretchr/testify/assert.ObjectsAreEqual()
      /home/runner/go/pkg/mod/github.com/stretchr/testify@v1.9.0/assert/assertions.go:65 +0x172
  github.com/stretchr/testify/assert.Equal()
      /home/runner/go/pkg/mod/github.com/stretchr/testify@v1.9.0/assert/assertions.go:463 +0x237
  github.com/stretchr/testify/assert.Equalf()
      /home/runner/go/pkg/mod/github.com/stretchr/testify@v1.9.0/assert/assertion_format.go:75 +0x1af
  github.com/stretchr/testify/require.Equalf()
      /home/runner/go/pkg/mod/github.com/stretchr/testify@v1.9.0/require/require.go:274 +0x124
  github.com/stretchr/testify/require.(*Assertions).Equalf()
      /home/runner/go/pkg/mod/github.com/stretchr/testify@v1.9.0/require/require_forward.go:223 +0x10d
  github.com/cockroachdb/replicator/internal/util/lockset.TestSmoke()
      /home/runner/work/replicator/replicator/internal/util/lockset/lockset_test.go:165 +0x815
  testing.tRunner()
      /opt/hostedtoolcache/go/1.22.6/x64/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /opt/hostedtoolcache/go/1.22.6/x64/src/testing/testing.go:1742 +0x44

Previous write at 0x00c000536b90 by goroutine 1280:
  github.com/cockroachdb/replicator/internal/util/lockset.TestSmoke.func1()
      /home/runner/work/replicator/replicator/internal/util/lockset/lockset_test.go:90 +0x295
  github.com/cockroachdb/replicator/internal/util/lockset.TestSmoke.func2.1()
      /home/runner/work/replicator/replicator/internal/util/lockset/lockset_test.go:155 +0x6c
  github.com/cockroachdb/replicator/internal/util/lockset.tryCall[go.shape.int]()
      /home/runner/work/replicator/replicator/internal/util/lockset/lockset.go:409 +0x14c
  github.com/cockroachdb/replicator/internal/util/lockset.(*Set[go.shape.int]).dispose.func1()
      /home/runner/work/replicator/replicator/internal/util/lockset/lockset.go:295 +0x32e
  github.com/cockroachdb/field-eng-powertools/workgroup.(*Group).worker()
      /home/runner/go/pkg/mod/github.com/cockroachdb/field-eng-powertools@v0.0.0-20240829142217-c680a7021280/workgroup/workgroup.go:149 +0x3ea
  github.com/cockroachdb/field-eng-powertools/workgroup.(*Group).maybeStart.gowrap2()
      /home/runner/go/pkg/mod/github.com/cockroachdb/field-eng-powertools@v0.0.0-20240829142217-c680a7021280/workgroup/workgroup.go:113 +0x5d

Goroutine 1041 (running) created at:
  testing.(*T).Run()
      /opt/hostedtoolcache/go/1.22.6/x64/src/testing/testing.go:1742 +0x825
  testing.runTests.func1()
      /opt/hostedtoolcache/go/1.22.6/x64/src/testing/testing.go:2161 +0x85
  testing.tRunner()
      /opt/hostedtoolcache/go/1.22.6/x64/src/testing/testing.go:1689 +0x21e
  testing.runTests()
      /opt/hostedtoolcache/go/1.22.6/x64/src/testing/testing.go:2159 +0x8be
  testing.(*M).Run()
      /opt/hostedtoolcache/go/1.22.6/x64/src/testing/testing.go:2027 +0xf17
  main.main()
      _testmain.go:105 +0x2e4

Goroutine 1280 (finished) created at:
  github.com/cockroachdb/field-eng-powertools/workgroup.(*Group).maybeStart()
      /home/runner/go/pkg/mod/github.com/cockroachdb/field-eng-powertools@v0.0.0-20240829142217-c680a7021280/workgroup/workgroup.go:113 +0x24f
  github.com/cockroachdb/field-eng-powertools/workgroup.(*Group).Go()
      /home/runner/go/pkg/mod/github.com/cockroachdb/field-eng-powertools@v0.0.0-20240829142217-c680a7021280/workgroup/workgroup.go:78 +0xaf
  github.com/cockroachdb/replicator/internal/util/lockset.(*Set[go.shape.int]).dispose()
      /home/runner/work/replicator/replicator/internal/util/lockset/lockset.go:367 +0x1c1
  github.com/cockroachdb/replicator/internal/util/lockset.(*Set[go.shape.int]).Schedule()
      /home/runner/work/replicator/replicator/internal/util/lockset/lockset.go:248 +0x7e7
  github.com/cockroachdb/replicator/internal/util/lockset.TestSmoke.func2()
      /home/runner/work/replicator/replicator/internal/util/lockset/lockset_test.go:155 +0x7b3
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      /home/runner/go/pkg/mod/golang.org/x/sync@v0.8.0/errgroup/errgroup.go:78 +0x91
==================
@bobvawter bobvawter added the bug Something isn't working label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant