Skip to content

data race in TestIndexNestedLoopHashJoin #64542

Closed

Description

@D3Hunter

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

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

WARNING: DATA RACE
Write at 0x00c010c7a430 by goroutine 42109:
  github.com/pingcap/tidb/pkg/util/execdetails.(*Percentile[go.shape.int64]).Add()
      pkg/util/execdetails/util.go:96 +0x14d
  github.com/pingcap/tidb/pkg/util/execdetails.(*basicCopRuntimeStats).mergeExecSummary()
      pkg/util/execdetails/runtime_stats.go:160 +0x2b1
  github.com/pingcap/tidb/pkg/util/execdetails.(*RuntimeStatsColl).RecordCopStats()
      pkg/util/execdetails/runtime_stats.go:616 +0x6a4
  github.com/pingcap/tidb/pkg/distsql.(*selectResult).updateCopRuntimeStats()
      pkg/distsql/select_result.go:689 +0x18ea
  github.com/pingcap/tidb/pkg/distsql.(*selectResult).fetchRespWithIntermediateResults()
      pkg/distsql/select_result.go:446 +0x904
  github.com/pingcap/tidb/pkg/distsql.(*selectResult).fetchResp()
      pkg/distsql/select_result.go:351 +0x3fe
  github.com/pingcap/tidb/pkg/distsql.(*selectResult).Next()
      pkg/distsql/select_result.go:476 +0x389
  github.com/pingcap/tidb/pkg/executor.(*indexWorker).extractTaskHandles()
      pkg/executor/distsql.go:1422 +0x4e2
  github.com/pingcap/tidb/pkg/executor.(*indexWorker).fetchHandles()
      pkg/executor/distsql.go:1252 +0xb1a
  github.com/pingcap/tidb/pkg/executor.(*IndexLookUpExecutor).startIndexWorker.func1()
      pkg/executor/distsql.go:919 +0x21f8
  github.com/pingcap/tidb/pkg/executor.(*workerPool).run()
      pkg/executor/utils.go:239 +0xd1
  github.com/pingcap/tidb/pkg/executor.(*workerPool).submit.gowrap1()
      pkg/executor/utils.go:221 +0x33

Previous read at 0x00c010c7a430 by goroutine 41942:
  github.com/pingcap/tidb/pkg/util/execdetails.(*CopRuntimeStats).GetTasks()
      pkg/util/execdetails/runtime_stats.go:222 +0x1e4
  github.com/pingcap/tidb/pkg/executor.(*IndexLookUpExecutor).Close.func1()
      pkg/executor/distsql.go:995 +0x189
  runtime.deferreturn()
      GOROOT/src/runtime/panic.go:611 +0x5d
  github.com/pingcap/tidb/pkg/executor/internal/exec.Close()
      pkg/executor/internal/exec/executor.go:480 +0x232
  github.com/pingcap/tidb/pkg/executor/join.(*innerWorker).fetchInnerResults.func2()
      pkg/executor/join/index_lookup_join.go:741 +0xa7
  runtime.deferreturn()
      GOROOT/src/runtime/panic.go:611 +0x5d
  github.com/pingcap/tidb/pkg/executor/join.(*indexHashJoinInnerWorker).handleTask()
      pkg/executor/join/index_lookup_hash_join.go:734 +0x8f1
  github.com/pingcap/tidb/pkg/executor/join.(*indexHashJoinInnerWorker).run()
      pkg/executor/join/index_lookup_hash_join.go:570 +0x52d
  github.com/pingcap/tidb/pkg/executor/join.(*IndexNestedLoopHashJoin).startWorkers.func2()
      pkg/executor/join/index_lookup_hash_join.go:194 +0xa6
  github.com/pingcap/tidb/pkg/util.WithRecovery()
      pkg/util/misc.go:101 +0xde
  github.com/pingcap/tidb/pkg/executor/join.(*IndexNestedLoopHashJoin).startWorkers.gowrap2()
      pkg/executor/join/index_lookup_hash_join.go:194 +0x44

Goroutine 42109 (running) created at:
  github.com/pingcap/tidb/pkg/executor.(*workerPool).submit()
      pkg/executor/utils.go:221 +0x424
  github.com/pingcap/tidb/pkg/executor.(*IndexLookUpExecutor).startIndexWorker()
      pkg/executor/distsql.go:827 +0x9c4
  github.com/pingcap/tidb/pkg/executor.(*IndexLookUpExecutor).startWorkers()
      pkg/executor/distsql.go:732 +0x2b7
  github.com/pingcap/tidb/pkg/executor.(*IndexLookUpExecutor).Next()
      pkg/executor/distsql.go:1052 +0x2c6
  github.com/pingcap/tidb/pkg/executor/internal/exec.Next()
      pkg/executor/internal/exec/executor.go:460 +0x4ed
  github.com/pingcap/tidb/pkg/executor/join.(*innerWorker).fetchInnerResults()
      pkg/executor/join/index_lookup_join.go:755 +0xb29
  github.com/pingcap/tidb/pkg/executor/join.(*indexHashJoinInnerWorker).handleTask()
      pkg/executor/join/index_lookup_hash_join.go:734 +0x8f1
  github.com/pingcap/tidb/pkg/executor/join.(*indexHashJoinInnerWorker).run()
      pkg/executor/join/index_lookup_hash_join.go:570 +0x52d
  github.com/pingcap/tidb/pkg/executor/join.(*IndexNestedLoopHashJoin).startWorkers.func2()
      pkg/executor/join/index_lookup_hash_join.go:194 +0xa6
  github.com/pingcap/tidb/pkg/util.WithRecovery()
      pkg/util/misc.go:101 +0xde
  github.com/pingcap/tidb/pkg/executor/join.(*IndexNestedLoopHashJoin).startWorkers.gowrap2()
      pkg/executor/join/index_lookup_hash_join.go:194 +0x44

Goroutine 41942 (running) created at:
  github.com/pingcap/tidb/pkg/executor/join.(*IndexNestedLoopHashJoin).startWorkers()
      pkg/executor/join/index_lookup_hash_join.go:194 +0x9d1
  github.com/pingcap/tidb/pkg/executor/join.(*IndexNestedLoopHashJoin).Next()
      pkg/executor/join/index_lookup_hash_join.go:245 +0x16d
  github.com/pingcap/tidb/pkg/executor/internal/exec.Next()
      pkg/executor/internal/exec/executor.go:460 +0x4ed
  github.com/pingcap/tidb/pkg/executor/aggregate.(*StreamAggExec).consumeCurGroupRowsAndFetchChild()
      pkg/executor/aggregate/agg_stream_executor.go:196 +0x2f7
  github.com/pingcap/tidb/pkg/executor/aggregate.(*StreamAggExec).consumeOneGroup()
      pkg/executor/aggregate/agg_stream_executor.go:124 +0x1c4
  github.com/pingcap/tidb/pkg/executor/aggregate.(*StreamAggExec).Next()
      pkg/executor/aggregate/agg_stream_executor.go:113 +0x484
  github.com/pingcap/tidb/pkg/executor/internal/exec.Next()
      pkg/executor/internal/exec/executor.go:460 +0x4ed
  github.com/pingcap/tidb/pkg/executor/sortexec.(*SortExec).fetchChunksFromChild()
      pkg/executor/sortexec/sort.go:728 +0x326
  github.com/pingcap/tidb/pkg/executor/sortexec.(*SortExec).fetchChunksParallel.func2()
      pkg/executor/sortexec/sort.go:677 +0x58
  github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).Run.func1()
      pkg/util/wait_group_wrapper.go:167 +0x97

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

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

Activity

  1. xzhangxian1008 commented on Dec 18, 2025

    @xzhangxian1008
    Contributor

    /assign

  2. xzhangxian1008 commented on Dec 19, 2025

    @xzhangxian1008
    Contributor

    /severity moderate

  3. added
    affects-8.5This bug affects the 8.5.x(LTS) versions.
    and removed on Dec 19, 2025
  4. added 2 commits that reference this issue on Dec 19, 2025
    e8fbcf7
    3173387
  5. added a commit that references this issue on Dec 19, 2025
    1e08348
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions