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 the (*Chunk).resetForReuse() #38914

Closed
hawkingrei opened this issue Nov 4, 2022 · 1 comment
Closed

DATA RACE in the (*Chunk).resetForReuse() #38914

hawkingrei opened this issue Nov 4, 2022 · 1 comment
Labels

Comments

@hawkingrei
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

==================
WARNING: DATA RACE
Write at 0x00c02a98e450 by goroutine 702063:
  github.com/pingcap/tidb/util/chunk.(*Chunk).resetForReuse()
      util/chunk/chunk.go:137 +0x7b8
  github.com/pingcap/tidb/util/chunk.(*allocator).Reset()
      util/chunk/alloc.go:123 +0x12a
  github.com/pingcap/tidb/testkit.(*TestKit).MustExec.func1()
      testkit/testkit.go:120 +0xde
  runtime.deferreturn()
      GOROOT/src/runtime/panic.go:476 +0x32
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1561 +0x6aa
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*ProjectionExec).parallelExecute()
      executor/projection.go:223 +0x651
  github.com/pingcap/tidb/executor.(*ProjectionExec).Next()
      executor/projection.go:181 +0xcc
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*ProjectionExec).parallelExecute()
      executor/projection.go:223 +0x651
  github.com/pingcap/tidb/executor.(*ProjectionExec).Next()
      executor/projection.go:181 +0xcc
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*ProjectionExec).parallelExecute()
      executor/projection.go:223 +0x651
  github.com/pingcap/tidb/executor.(*ProjectionExec).Next()
      executor/projection.go:181 +0xcc
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*ProjectionExec).parallelExecute()
      executor/projection.go:223 +0x651
  github.com/pingcap/tidb/executor.(*ProjectionExec).Next()
      executor/projection.go:181 +0xcc
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*StreamAggExec).consumeGroupRows()
      executor/aggregate.go:1382 +0x124
  github.com/pingcap/tidb/executor.(*StreamAggExec).consumeOneGroup()
      executor/aggregate.go:1361 +0xad1
  github.com/pingcap/tidb/executor.(*StreamAggExec).Next()
      executor/aggregate.go:1313 +0x215
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*StreamAggExec).appendResult2Chunk()
      executor/aggregate.go:1429 +0x276
  github.com/pingcap/tidb/executor.(*StreamAggExec).consumeOneGroup()
      executor/aggregate.go:1366 +0xb24
  github.com/pingcap/tidb/executor.(*StreamAggExec).Next()
      executor/aggregate.go:1313 +0x215
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*StreamAggExec).consumeGroupRows()
      executor/aggregate.go:1382 +0x124
  github.com/pingcap/tidb/executor.(*StreamAggExec).consumeOneGroup()
      executor/aggregate.go:1361 +0xad1
  github.com/pingcap/tidb/executor.(*StreamAggExec).Next()
      executor/aggregate.go:1313 +0x215
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*StreamAggExec).appendResult2Chunk()
      executor/aggregate.go:1429 +0x276
  github.com/pingcap/tidb/executor.(*StreamAggExec).consumeOneGroup()
      executor/aggregate.go:1366 +0xb24
  github.com/pingcap/tidb/executor.(*StreamAggExec).Next()
      executor/aggregate.go:1313 +0x215
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*StreamAggExec).consumeGroupRows()
      executor/aggregate.go:1382 +0x124
  github.com/pingcap/tidb/executor.(*StreamAggExec).consumeOneGroup()
      executor/aggregate.go:1361 +0xad1
  github.com/pingcap/tidb/executor.(*StreamAggExec).Next()
      executor/aggregate.go:1313 +0x215
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*StreamAggExec).consumeGroupRows()
      executor/aggregate.go:1382 +0x124
  github.com/pingcap/tidb/executor.(*StreamAggExec).consumeOneGroup()
      executor/aggregate.go:1361 +0xad1
  github.com/pingcap/tidb/executor.(*StreamAggExec).Next()
      executor/aggregate.go:1313 +0x215
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*StreamAggExec).consumeGroupRows()
      executor/aggregate.go:1382 +0x124
  github.com/pingcap/tidb/executor.(*StreamAggExec).consumeCurGroupRowsAndFetchChild()
      executor/aggregate.go:1390 +0x64
  github.com/pingcap/tidb/executor.(*StreamAggExec).consumeOneGroup()
      executor/aggregate.go:1343 +0x70c
  github.com/pingcap/tidb/executor.(*StreamAggExec).Next()
      executor/aggregate.go:1313 +0x215
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*StreamAggExec).appendResult2Chunk()
      executor/aggregate.go:1429 +0x276
  github.com/pingcap/tidb/executor.(*StreamAggExec).consumeOneGroup()
      executor/aggregate.go:1366 +0xb24
  github.com/pingcap/tidb/executor.(*StreamAggExec).Next()
      executor/aggregate.go:1313 +0x215
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*StreamAggExec).consumeGroupRows()
      executor/aggregate.go:1382 +0x124
  github.com/pingcap/tidb/executor.(*StreamAggExec).consumeOneGroup()
      executor/aggregate.go:1361 +0xad1
  github.com/pingcap/tidb/executor.(*StreamAggExec).Next()
      executor/aggregate.go:1313 +0x215
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*StreamAggExec).appendResult2Chunk()
      executor/aggregate.go:1429 +0x276
  github.com/pingcap/tidb/executor.(*StreamAggExec).consumeOneGroup()
      executor/aggregate.go:1366 +0xb24
  github.com/pingcap/tidb/executor.(*StreamAggExec).Next()
      executor/aggregate.go:1313 +0x215
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/tidb/executor.(*HashAggExec).Open()
      executor/aggregate.go:311 +0x3ba
  github.com/pingcap/tidb/executor.(*ExecStmt).openExecutor()
      executor/adapter.go:1111 +0xe9
  github.com/pingcap/tidb/executor.(*ExecStmt).Exec()
      executor/adapter.go:494 +0x994
  github.com/pingcap/tidb/session.runStmt()
      session/session.go:2333 +0x761
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      session/session.go:2197 +0x1025
  github.com/pingcap/tidb/testkit.(*TestKit).ExecWithContext()
      testkit/testkit.go:296 +0x7c7
  github.com/pingcap/tidb/testkit.(*TestKit).Exec()
      testkit/testkit.go:270 +0x866
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1568 +0x829
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*HashAggExec).getPartialResults()
      executor/aggregate.go:1120 +0x1de
  github.com/pingcap/tidb/executor.(*HashAggExec).execute()
      executor/aggregate.go:1038 +0xee9
  github.com/pingcap/tidb/executor.(*HashAggExec).unparallelExec()
      executor/aggregate.go:963 +0x17a
  github.com/pingcap/tidb/executor.(*HashAggExec).Next()
      executor/aggregate.go:782 +0x106
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*HashAggExec).getPartialResults()
      executor/aggregate.go:1120 +0x1de
  github.com/pingcap/tidb/executor.(*HashAggExec).execute()
      executor/aggregate.go:1038 +0xee9
  github.com/pingcap/tidb/executor.(*HashAggExec).unparallelExec()
      executor/aggregate.go:963 +0x17a
  github.com/pingcap/tidb/executor.(*HashAggExec).Next()
      executor/aggregate.go:782 +0x106
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/tidb/executor.(*HashAggExec).Open()
      executor/aggregate.go:311 +0x3ba
  github.com/pingcap/tidb/executor.(*ExecStmt).openExecutor()
      executor/adapter.go:1111 +0xe9
  github.com/pingcap/tidb/executor.(*ExecStmt).Exec()
      executor/adapter.go:494 +0x994
  github.com/pingcap/tidb/session.runStmt()
      session/session.go:2333 +0x761
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      session/session.go:2197 +0x1025
  github.com/pingcap/tidb/testkit.(*TestKit).ExecWithContext()
      testkit/testkit.go:296 +0x7c7
  github.com/pingcap/tidb/testkit.(*TestKit).Exec()
      testkit/testkit.go:270 +0x866
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1568 +0x829
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*HashAggExec).getPartialResults()
      executor/aggregate.go:1120 +0x1de
  github.com/pingcap/tidb/executor.(*HashAggExec).execute()
      executor/aggregate.go:1038 +0xee9
  github.com/pingcap/tidb/executor.(*HashAggExec).unparallelExec()
      executor/aggregate.go:963 +0x17a
  github.com/pingcap/tidb/executor.(*HashAggExec).Next()
      executor/aggregate.go:782 +0x106
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*HashAggExec).getPartialResults()
      executor/aggregate.go:1120 +0x1de
  github.com/pingcap/tidb/executor.(*HashAggExec).execute()
      executor/aggregate.go:1038 +0xee9
  github.com/pingcap/tidb/executor.(*HashAggExec).unparallelExec()
      executor/aggregate.go:963 +0x17a
  github.com/pingcap/tidb/executor.(*HashAggExec).Next()
      executor/aggregate.go:782 +0x106
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*HashAggExec).getPartialResults()
      executor/aggregate.go:1120 +0x1de
  github.com/pingcap/tidb/executor.(*HashAggExec).execute()
      executor/aggregate.go:1038 +0xee9
  github.com/pingcap/tidb/executor.(*HashAggExec).unparallelExec()
      executor/aggregate.go:963 +0x17a
  github.com/pingcap/tidb/executor.(*HashAggExec).Next()
      executor/aggregate.go:782 +0x106
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/tidb/executor.(*HashAggExec).Open()
      executor/aggregate.go:311 +0x3ba
  github.com/pingcap/tidb/executor.(*ExecStmt).openExecutor()
      executor/adapter.go:1111 +0xe9
  github.com/pingcap/tidb/executor.(*ExecStmt).Exec()
      executor/adapter.go:494 +0x994
  github.com/pingcap/tidb/session.runStmt()
      session/session.go:2333 +0x761
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      session/session.go:2197 +0x1025
  github.com/pingcap/tidb/testkit.(*TestKit).ExecWithContext()
      testkit/testkit.go:296 +0x7c7
  github.com/pingcap/tidb/testkit.(*TestKit).Exec()
      testkit/testkit.go:270 +0x866
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1568 +0x829
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*HashAggExec).execute()
      executor/aggregate.go:1004 +0x269
  github.com/pingcap/tidb/executor.(*HashAggExec).unparallelExec()
      executor/aggregate.go:963 +0x17a
  github.com/pingcap/tidb/executor.(*HashAggExec).Next()
      executor/aggregate.go:782 +0x106
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*HashAggExec).getPartialResults()
      executor/aggregate.go:1120 +0x1de
  github.com/pingcap/tidb/executor.(*HashAggExec).execute()
      executor/aggregate.go:1038 +0xee9
  github.com/pingcap/tidb/executor.(*HashAggExec).unparallelExec()
      executor/aggregate.go:963 +0x17a
  github.com/pingcap/tidb/executor.(*HashAggExec).Next()
      executor/aggregate.go:782 +0x106
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/failpoint.Eval()
      external/com_github_pingcap_failpoint/failpoints.go:271 +0x44
  github.com/pingcap/tidb/executor.(*HashAggExec).getPartialResults()
      executor/aggregate.go:1120 +0x1de
  github.com/pingcap/tidb/executor.(*HashAggExec).execute()
      executor/aggregate.go:1038 +0xee9
  github.com/pingcap/tidb/executor.(*HashAggExec).unparallelExec()
      executor/aggregate.go:963 +0x17a
  github.com/pingcap/tidb/executor.(*HashAggExec).Next()
      executor/aggregate.go:782 +0x106
  github.com/pingcap/tidb/executor.Next()
      executor/executor.go:325 +0x5c3
  github.com/pingcap/tidb/executor.(*ExecStmt).next()
      executor/adapter.go:1118 +0x89
  github.com/pingcap/tidb/executor.(*recordSet).Next()
      executor/adapter.go:153 +0x164
  github.com/pingcap/tidb/session.(*execStmtResult).Next()
      <autogenerated>:1 +0x76
  github.com/pingcap/tidb/session.GetRows4Test()
      session/tidb.go:336 +0xea
  github.com/pingcap/tidb/executor_test.TestRandomPanicConsume()
      executor/aggregate_test.go:1570 +0x904
  github.com/pingcap/tidb/executor.(*HashAggExec).Open()
      executor/aggregate.go:314 +0x3f1
  github.com/pingcap/tidb/executor.(*ExecStmt).openExecutor()
      executor/adapter.go:1111 +0xe9
  github.com/pingcap/tidb/executor.(*ExecStmt).Exec()
      executor/adapter.go:494 +0x994
  github.com/pingcap/tidb/session.runStmt()
      session/session.go:2333 +0x761
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      session/session.go:2197 +0x1025
Previous read at 0x00c02a98e450 by goroutine 716207:
  github.com/pingcap/tidb/util/chunk.(*Chunk).NumRows()
      util/chunk/chunk.go:352 +0x552
  github.com/pingcap/tidb/executor.(*HashJoinExec).fetchBuildSideRows()
      executor/join.go:308 +0x4d8
  github.com/pingcap/tidb/executor.(*HashJoinExec).fetchAndBuildHashTable.func2()
      executor/join.go:1170 +0xea
  github.com/pingcap/tidb/util.WithRecovery()
      util/misc.go:96 +0x6d
  github.com/pingcap/tidb/executor.(*HashJoinExec).fetchAndBuildHashTable.func4()
      executor/join.go:1167 +0x47
Goroutine 702063 (running) created at:
  testing.(*T).Run()
      GOROOT/src/testing/testing.go:1493 +0x75d
  testing.runTests.func1()
      GOROOT/src/testing/testing.go:1846 +0x99
  testing.tRunner()
      GOROOT/src/testing/testing.go:1446 +0x216
  testing.runTests()
      GOROOT/src/testing/testing.go:1844 +0x7ec
  testing.(*M).Run()
      GOROOT/src/testing/testing.go:1726 +0xa84
  github.com/pingcap/tidb/testkit/testmain.(*testingM).Run()
      testkit/testmain/wrapper.go:27 +0x42
  go.uber.org/goleak.VerifyTestMain()
      external/org_uber_go_goleak/testmain.go:53 +0x70
  github.com/pingcap/tidb/executor_test.TestMain()
      executor/main_test.go:70 +0xbc6
  main.main()
      bazel-out/k8-fastbuild/bin/executor/executor_test_/testmain.go:2288 +0x5e8
Goroutine 716207 (finished) created at:
  github.com/pingcap/tidb/executor.(*HashJoinExec).fetchAndBuildHashTable()
      executor/join.go:1167 +0x3d6
  github.com/pingcap/tidb/executor.(*HashJoinExec).Next.func1()
      executor/join.go:1126 +0xbc
  github.com/pingcap/tidb/util.WithRecovery()
      util/misc.go:96 +0x6d
  github.com/pingcap/tidb/executor.(*HashJoinExec).Next.func2()
      executor/join.go:1124 +0x47
================== 

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

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

@hawkingrei hawkingrei added the type/bug The issue is confirmed as a bug. label Nov 4, 2022
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.0 may-affects-6.1 may-affects-6.2 may-affects-6.3 labels Nov 5, 2022
@ChenPeng2013 ChenPeng2013 removed may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-6.0 may-affects-6.1 may-affects-6.2 may-affects-6.3 labels Nov 5, 2022
ti-chi-bot pushed a commit that referenced this issue Nov 8, 2022
@hawkingrei hawkingrei reopened this Nov 9, 2022
@xhebox
Copy link
Contributor

xhebox commented Nov 9, 2022

Reproduced with RACE at

metrics.DistSQLPartialCountHistogram.Observe(float64(r.partialCount))
. It is a goroutine leak of hashjoin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants