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 hash join v2 #57450

Closed
windtalker opened this issue Nov 18, 2024 · 0 comments · Fixed by #57451
Closed

data race in hash join v2 #57450

windtalker opened this issue Nov 18, 2024 · 0 comments · Fixed by #57451
Labels
affects-8.5 This bug affects the 8.5.x(LTS) versions. severity/moderate sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@windtalker
Copy link
Contributor

windtalker commented Nov 18, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

Data race 1

Read at 0x00c003ecf9a9 by goroutine 7364:
  github.com/pingcap/tidb/pkg/executor/join.(*joinTableMeta).getSerializedKeyLength()
      pkg/executor/join/join_table_meta.go:70 +0x19a
  github.com/pingcap/tidb/pkg/executor/join.isKeyMatched()
      pkg/executor/join/base_join_probe.go:690 +0x1b2
  github.com/pingcap/tidb/pkg/executor/join.(*outerJoinProbe).probeForOuterSideBuild()
      pkg/executor/join/outer_join_probe.go:329 +0x4af
  github.com/pingcap/tidb/pkg/executor/join.(*outerJoinProbe).Probe()
      pkg/executor/join/outer_join_probe.go:384 +0x4b1
  github.com/pingcap/tidb/pkg/executor/join.(*ProbeWorkerV2).probeAndSendResult()
      pkg/executor/join/hash_join_v2.go:950 +0x221
  github.com/pingcap/tidb/pkg/executor/join.(*ProbeWorkerV2).processOneProbeChunk()
      pkg/executor/join/hash_join_v2.go:939 +0xe4
  github.com/pingcap/tidb/pkg/executor/join.(*ProbeWorkerV2).runJoinWorker()
      pkg/executor/join/hash_join_v2.go:1012 +0x72e
  github.com/pingcap/tidb/pkg/executor/join.(*HashJoinV2Exec).startProbeJoinWorkers.func1()
      pkg/executor/join/hash_join_v2.go:844 +0x204
  github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).RunWithRecover.func1()
      pkg/util/wait_group_wrapper.go:189 +0xa5
Previous write at 0x00c003ecf9a8 by goroutine 7363:
  sync/atomic.StoreInt32()
      src/runtime/race_amd64.s:231 +0xb
  sync/atomic.StoreUint32()
      <autogenerated>:1 +0x14
  github.com/pingcap/tidb/pkg/executor/join.(*outerJoinProbe).probeForOuterSideBuild()
      pkg/executor/join/outer_join_probe.go:334 +0x512
  github.com/pingcap/tidb/pkg/executor/join.(*outerJoinProbe).Probe()
      pkg/executor/join/outer_join_probe.go:384 +0x4b1
  github.com/pingcap/tidb/pkg/executor/join.(*ProbeWorkerV2).probeAndSendResult()
      pkg/executor/join/hash_join_v2.go:950 +0x221
  github.com/pingcap/tidb/pkg/executor/join.(*ProbeWorkerV2).processOneProbeChunk()
      pkg/executor/join/hash_join_v2.go:939 +0xe4
  github.com/pingcap/tidb/pkg/executor/join.(*ProbeWorkerV2).runJoinWorker()
      pkg/executor/join/hash_join_v2.go:1012 +0x72e
  github.com/pingcap/tidb/pkg/executor/join.(*HashJoinV2Exec).startProbeJoinWorkers.func1()
      pkg/executor/join/hash_join_v2.go:844 +0x204
  github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).RunWithRecover.func1()
      pkg/util/wait_group_wrapper.go:189 +0xa5

Data race 2

Write at 0x00c0032925f8 by goroutine 3299:
  github.com/pingcap/tidb/pkg/executor/join.(*BuildWorkerV2).splitPartitionAndAppendToRowTableForRestore()
      pkg/executor/join/hash_join_v2.go:510 +0x490
  github.com/pingcap/tidb/pkg/executor/join.(*HashJoinV2Exec).splitAndAppendToRowTable.func1()
      pkg/executor/join/hash_join_v2.go:1400 +0x189
  github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).RunWithRecover.func1()
      pkg/util/wait_group_wrapper.go:189 +0xa5
Previous read at 0x00c0032925f8 by goroutine 3302:
  github.com/pingcap/tidb/pkg/executor/join.(*hashJoinSpillHelper).spillRowTableImpl.func1()
      pkg/executor/join/hash_join_spill_helper.go:402 +0x153
  github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).RunWithRecover.func1()
      pkg/util/wait_group_wrapper.go:189 +0xa5
Goroutine 3299 (running) created at:
  github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).RunWithRecover()
      pkg/util/wait_group_wrapper.go:181 +0x124
  github.com/pingcap/tidb/pkg/executor/join.(*HashJoinV2Exec).splitAndAppendToRowTable()
      pkg/executor/join/hash_join_v2.go:1397 +0xb8
  github.com/pingcap/tidb/pkg/executor/join.(*HashJoinV2Exec).fetchAndBuildHashTableImpl()
      pkg/executor/join/hash_join_v2.go:1267 +0x317
  github.com/pingcap/tidb/pkg/executor/join.(*HashJoinV2Exec).startBuildAndProbe.(*HashJoinV2Exec).fetchAndBuildHashTable.func2()
      pkg/executor/join/hash_join_v2.go:1237 +0xbc
  github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).RunWithRecover.func1()
      pkg/util/wait_group_wrapper.go:189 +0xa5
Goroutine 3302 (finished) created at:
  github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).RunWithRecover()
      pkg/util/wait_group_wrapper.go:181 +0x124
  github.com/pingcap/tidb/pkg/executor/join.(*hashJoinSpillHelper).spillRowTableImpl()
      pkg/executor/join/hash_join_spill_helper.go:397 +0x48b
  github.com/pingcap/tidb/pkg/executor/join.(*hashJoinSpillHelper).spillRowTable()
      pkg/executor/join/hash_join_spill_helper.go:473 +0x27d
  github.com/pingcap/tidb/pkg/executor/join.checkAndSpillRowTableIfNeeded()
      pkg/executor/join/hash_join_base.go:252 +0x58
  github.com/pingcap/tidb/pkg/executor/join.(*HashJoinV2Exec).controlWorkersForRestore()
      pkg/executor/join/hash_join_v2.go:1363 +0x328
  github.com/pingcap/tidb/pkg/executor/join.(*HashJoinV2Exec).fetchBuildSideRows.func1()
      pkg/executor/join/hash_join_v2.go:1306 +0x35d
  github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).RunWithRecover.func1()
      pkg/util/wait_group_wrapper.go:189 +0xa5

1. Minimal reproduce step (Required)

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

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-8.5 This bug affects the 8.5.x(LTS) versions. severity/moderate sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants