pingcap / tidb

TiDB - the open-source, cloud-native, distributed SQL database designed for modern applications.
https://pingcap.com
Apache License 2.0
37.42k stars 5.85k forks source link

DATA RACE in the TestSimpleRestorerImportAndProgress #57760

Closed hawkingrei closed 1 week ago

hawkingrei commented 1 week ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

2. What did you expect to see? (Required)

3. What did you see instead (Required)

==================
WARNING: DATA RACE
Read at 0x00c000f78108 by goroutine 67:
  br/pkg/restore/restore_test_test.TestSimpleRestorerImportAndProgress.func2()
      br/pkg/restore/restorer_test.go:69 +0x2f
  github.com/pingcap/tidb/br/pkg/restore.(*SimpleRestorer).GoRestore.func1.1()
      br/pkg/restore/restorer.go:198 +0x331
  runtime.deferreturn()
      GOROOT/src/runtime/panic.go:605 +0x5d
  github.com/pingcap/tidb/pkg/util.(*WorkerPool).ApplyOnErrorGroup.func1()
      pkg/util/worker_pool.go:81 +0xba
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      external/org_golang_x_sync/errgroup/errgroup.go:78 +0x91
Previous write at 0x00c000f78108 by goroutine 68:
  br/pkg/restore/restore_test_test.TestSimpleRestorerImportAndProgress.func2()
      br/pkg/restore/restorer_test.go:69 +0x46
  github.com/pingcap/tidb/br/pkg/restore.(*SimpleRestorer).GoRestore.func1.1()
      br/pkg/restore/restorer.go:198 +0x331
  runtime.deferreturn()
      GOROOT/src/runtime/panic.go:605 +0x5d
  github.com/pingcap/tidb/pkg/util.(*WorkerPool).ApplyOnErrorGroup.func1()
      pkg/util/worker_pool.go:81 +0xba
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      external/org_golang_x_sync/errgroup/errgroup.go:78 +0x91
Goroutine 67 (running) created at:
  golang.org/x/sync/errgroup.(*Group).Go()
      external/org_golang_x_sync/errgroup/errgroup.go:75 +0x124
  github.com/pingcap/tidb/pkg/util.(*WorkerPool).ApplyOnErrorGroup()
      pkg/util/worker_pool.go:79 +0x129
  github.com/pingcap/tidb/br/pkg/restore.(*SimpleRestorer).GoRestore()
      br/pkg/restore/restorer.go:190 +0x104
  br/pkg/restore/restore_test_test.TestSimpleRestorerImportAndProgress()
      br/pkg/restore/restorer_test.go:68 +0x81a
  testing.tRunner()
      GOROOT/src/testing/testing.go:1690 +0x226
  testing.(*T).Run.gowrap1()
      GOROOT/src/testing/testing.go:1743 +0x44
Goroutine 68 (finished) created at:
  golang.org/x/sync/errgroup.(*Group).Go()
      external/org_golang_x_sync/errgroup/errgroup.go:75 +0x124
  github.com/pingcap/tidb/pkg/util.(*WorkerPool).ApplyOnErrorGroup()
      pkg/util/worker_pool.go:79 +0x129
  github.com/pingcap/tidb/br/pkg/restore.(*SimpleRestorer).GoRestore()
      br/pkg/restore/restorer.go:190 +0x104
  br/pkg/restore/restore_test_test.TestSimpleRestorerImportAndProgress()
      br/pkg/restore/restorer_test.go:68 +0x81a
  testing.tRunner()
      GOROOT/src/testing/testing.go:1690 +0x226
  testing.(*T).Run.gowrap1()
      GOROOT/src/testing/testing.go:1743 +0x44
==================
--- FAIL: TestSimpleRestorerImportAndProgress (0.06s)
    testing.go:1399: race detected during execution of test
FAIL

4. What is your TiDB version? (Required)

hawkingrei commented 1 week ago

https://tiprow.hawkingrei.com/view/gs/pingcapprow/logs/tidb_data_race/1861633706834268160#1:build-log.txt%3A4852