Skip to content

data race in TestExternalEngine #46783

@lance6716

Description

@lance6716

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)

https://do.pingcap.net/jenkins/blue/rest/organizations/jenkins/pipelines/pingcap/pipelines/tidb/pipelines/ghpr_unit_test/runs/32449/nodes/59/steps/64/log/?start=0

WARNING: DATA RACE
Read at 0x00c000ac1f50 by goroutine 144:
  slices.insertionSortCmpFunc[go.shape.*uint8]()
      GOROOT/src/slices/zsortanyfunc.go:12 +0xfd
  slices.pdqsortCmpFunc[go.shape.*uint8]()
      GOROOT/src/slices/zsortanyfunc.go:73 +0x6c8
  slices.SortFunc[go.shape.[]*github.com/pingcap/tidb/store/pdtypes.Region,go.shape.*uint8]()
      GOROOT/src/slices/sort.go:28 +0xc6
  github.com/pingcap/tidb/store/pdtypes.(*RegionTree).ScanRange()
      store/pdtypes/region_tree.go:55 +0x7b
  github.com/pingcap/tidb/br/pkg/lightning/backend/local.(*testSplitClient).ScanRegions()
      br/pkg/lightning/backend/local/localhelper_test.go:257 +0x1cf
  github.com/pingcap/tidb/br/pkg/restore/split.PaginateScanRegion.func1()
      br/pkg/restore/split/split.go:106 +0x1b6
  github.com/pingcap/tidb/br/pkg/utils.WithRetry.func1()
      br/pkg/utils/retry.go:57 +0x41
  github.com/pingcap/tidb/br/pkg/utils.WithRetryV2[go.shape.struct {}]()
      br/pkg/utils/retry.go:75 +0xe1
  github.com/pingcap/tidb/br/pkg/utils.WithRetry()
      br/pkg/utils/retry.go:56 +0x8c
  github.com/pingcap/tidb/br/pkg/restore/split.PaginateScanRegion()
      br/pkg/restore/split/split.go:101 +0x28f
  github.com/pingcap/tidb/br/pkg/lightning/backend/local.(*Backend).generateJobForRange()
      br/pkg/lightning/backend/local/local.go:1264 +0x2ec
  github.com/pingcap/tidb/br/pkg/lightning/backend/local.(*Backend).generateAndSendJob.func1()
      br/pkg/lightning/backend/local/local.go:1196 +0x1f9
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      external/org_golang_x_sync/errgroup/errgroup.go:75 +0x76

Previous write at 0x00c000ac1f50 by goroutine 145:
  slices.insertionSortCmpFunc[go.shape.*uint8]()
      GOROOT/src/slices/zsortanyfunc.go:13 +0x211
  slices.pdqsortCmpFunc[go.shape.*uint8]()
      GOROOT/src/slices/zsortanyfunc.go:73 +0x6c8
  slices.SortFunc[go.shape.[]*github.com/pingcap/tidb/store/pdtypes.Region,go.shape.*uint8]()
      GOROOT/src/slices/sort.go:28 +0xc6
  github.com/pingcap/tidb/store/pdtypes.(*RegionTree).ScanRange()
      store/pdtypes/region_tree.go:55 +0x7b
  github.com/pingcap/tidb/br/pkg/lightning/backend/local.(*testSplitClient).ScanRegions()
      br/pkg/lightning/backend/local/localhelper_test.go:257 +0x1cf
  github.com/pingcap/tidb/br/pkg/restore/split.PaginateScanRegion.func1()
      br/pkg/restore/split/split.go:106 +0x1b6
  github.com/pingcap/tidb/br/pkg/utils.WithRetry.func1()
      br/pkg/utils/retry.go:57 +0x41
  github.com/pingcap/tidb/br/pkg/utils.WithRetryV2[go.shape.struct {}]()
      br/pkg/utils/retry.go:75 +0xe1
  github.com/pingcap/tidb/br/pkg/utils.WithRetry()
      br/pkg/utils/retry.go:56 +0x8c
  github.com/pingcap/tidb/br/pkg/restore/split.PaginateScanRegion()
      br/pkg/restore/split/split.go:101 +0x28f
  github.com/pingcap/tidb/br/pkg/lightning/backend/local.(*Backend).generateJobForRange()
      br/pkg/lightning/backend/local/local.go:1264 +0x2ec
  github.com/pingcap/tidb/br/pkg/lightning/backend/local.(*Backend).generateAndSendJob.func1()
      br/pkg/lightning/backend/local/local.go:1196 +0x1f9
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      external/org_golang_x_sync/errgroup/errgroup.go:75 +0x76

Goroutine 144 (running) created at:
  golang.org/x/sync/errgroup.(*Group).Go()
      external/org_golang_x_sync/errgroup/errgroup.go:72 +0x124
  github.com/pingcap/tidb/br/pkg/lightning/backend/local.(*Backend).generateAndSendJob()
      br/pkg/lightning/backend/local/local.go:1190 +0x4ae
  github.com/pingcap/tidb/br/pkg/lightning/backend/local.(*Backend).prepareAndSendJob()
      br/pkg/lightning/backend/local/local.go:1134 +0xa18
  github.com/pingcap/tidb/br/pkg/lightning/backend/local.(*Backend).doImport()
      br/pkg/lightning/backend/local/local.go:1645 +0x7e6
  github.com/pingcap/tidb/br/pkg/lightning/backend/local.(*Backend).ImportEngine()
      br/pkg/lightning/backend/local/local.go:1531 +0x12fd
  github.com/pingcap/tidb/br/pkg/lightning/backend/local.TestExternalEngine.func3()
      br/pkg/lightning/backend/local/local_test.go:2224 +0x124

Goroutine 145 (finished) created at:
  golang.org/x/sync/errgroup.(*Group).Go()
      external/org_golang_x_sync/errgroup/errgroup.go:72 +0x124
  github.com/pingcap/tidb/br/pkg/lightning/backend/local.(*Backend).generateAndSendJob()
      br/pkg/lightning/backend/local/local.go:1190 +0x4ae
  github.com/pingcap/tidb/br/pkg/lightning/backend/local.(*Backend).prepareAndSendJob()
      br/pkg/lightning/backend/local/local.go:1134 +0xa18
  github.com/pingcap/tidb/br/pkg/lightning/backend/local.(*Backend).doImport()
      br/pkg/lightning/backend/local/local.go:1645 +0x7e6
  github.com/pingcap/tidb/br/pkg/lightning/backend/local.(*Backend).ImportEngine()
      br/pkg/lightning/backend/local/local.go:1531 +0x12fd
  github.com/pingcap/tidb/br/pkg/lightning/backend/local.TestExternalEngine.func3()
      br/pkg/lightning/backend/local/local_test.go:2224 +0x124

4. What is your TiDB version? (Required)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions