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 github.com/pingcap/tidb/pkg/planner/core.(*PointGetPlan) #49803

Closed
Tracked by #41316
hawkingrei opened this issue Dec 26, 2023 · 1 comment · Fixed by #53676
Closed
Tracked by #41316

DATA RACE in the github.com/pingcap/tidb/pkg/planner/core.(*PointGetPlan) #49803

hawkingrei opened this issue Dec 26, 2023 · 1 comment · Fixed by #53676
Assignees
Labels
affects-8.1 This bug affects the 8.1.x(LTS) versions. component/test may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@hawkingrei
Copy link
Member

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
Write at 0x00c006a246c0 by goroutine 36524:
  github.com/pingcap/tidb/pkg/planner/core.(*PointGetPlan).StatsInfo()
      pkg/planner/core/point_get_plan.go:227 +0x110
  github.com/pingcap/tidb/pkg/planner/core.(*PointGetPlan).getEstRowCountForDisplay()
      pkg/planner/core/point_get_plan.go:109 +0xe3
  github.com/pingcap/tidb/pkg/planner/core.encodeFlatPlanTree()
      pkg/planner/core/encode.go:105 +0x235
  github.com/pingcap/tidb/pkg/planner/core.EncodeFlatPlan()
      pkg/planner/core/encode.go:62 +0x538
  github.com/pingcap/tidb/pkg/executor.getEncodedPlan()
      pkg/executor/adapter.go:1797 +0x15b
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).SummaryStmt.func1()
      pkg/executor/adapter.go:1858 +0x5d
  github.com/pingcap/tidb/pkg/util/stmtsummary.newStmtSummaryByDigestElement()
      pkg/util/stmtsummary/statement_summary.go:644 +0x68
  github.com/pingcap/tidb/pkg/util/stmtsummary.(*stmtSummaryByDigest).add.func1()
      pkg/util/stmtsummary/statement_summary.go:599 +0x284
  github.com/pingcap/tidb/pkg/util/stmtsummary.(*stmtSummaryByDigest).add()
      pkg/util/stmtsummary/statement_summary.go:610 +0x4e
  github.com/pingcap/tidb/pkg/util/stmtsummary.(*stmtSummaryByDigestMap).AddStatement()
      pkg/util/stmtsummary/statement_summary.go:353 +0x5a4
  github.com/pingcap/tidb/pkg/util/stmtsummary/v2.Add()
      pkg/util/stmtsummary/v2/stmtsummary.go:541 +0x99
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).SummaryStmt()
      pkg/executor/adapter.go:1962 +0x1b6b
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).FinishExecuteStmt()
      pkg/executor/adapter.go:1397 +0x5d9
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).CloseRecordSet()
      pkg/executor/adapter.go:1471 +0x4a
  github.com/pingcap/tidb/pkg/executor.(*recordSet).Close()
      pkg/executor/adapter.go:206 +0x219
  github.com/pingcap/tidb/pkg/session.(*execStmtResult).Close()
      pkg/session/session.go:2459 +0x93
  github.com/pingcap/tidb/pkg/util/sqlexec.RecordSet.Close-fm()
      <autogenerated>:1 +0x42
  github.com/pingcap/tidb/pkg/parser/terror.Call()
      pkg/parser/terror/terror.go:315 +0x3e
  github.com/pingcap/tidb/pkg/server/internal/resultset.(*tidbResultSet).Close()
      pkg/server/internal/resultset/resultset.go:78 +0xb8
  github.com/pingcap/tidb/pkg/server.(*clientConn).handleStmt.func2()
      pkg/server/conn.go:1981 +0x42
  runtime.deferreturn()
      GOROOT/src/runtime/panic.go:477 +0x30
  github.com/pingcap/tidb/pkg/server.(*clientConn).handleQuery()
      pkg/server/conn.go:1748 +0xd52
  github.com/pingcap/tidb/pkg/server.(*clientConn).dispatch()
      pkg/server/conn.go:1322 +0x1564
  github.com/pingcap/tidb/pkg/server.(*clientConn).Run()
      pkg/server/conn.go:1101 +0x844
  github.com/pingcap/tidb/pkg/server.(*Server).onConn()
      pkg/server/server.go:701 +0x15e4
  github.com/pingcap/tidb/pkg/server.(*Server).startNetworkListener.func2()
      pkg/server/server.go:517 +0x44
Previous write at 0x00c006a246c0 by goroutine 37386:
  github.com/pingcap/tidb/pkg/planner/core.(*PointGetPlan).StatsInfo()
      pkg/planner/core/point_get_plan.go:227 +0x110
  github.com/pingcap/tidb/pkg/planner/core.(*PointGetPlan).getEstRowCountForDisplay()
      pkg/planner/core/point_get_plan.go:109 +0xe3
  github.com/pingcap/tidb/pkg/planner/core.binaryOpFromFlatOp()
      pkg/planner/core/common_plans.go:1267 +0x615
  github.com/pingcap/tidb/pkg/planner/core.binaryOpTreeFromFlatOps()
      pkg/planner/core/common_plans.go:1223 +0xf0
  github.com/pingcap/tidb/pkg/planner/core.binaryDataFromFlatPlan()
      pkg/planner/core/common_plans.go:1213 +0x1ef
  github.com/pingcap/tidb/pkg/planner/core.BinaryPlanStrFromFlatPlan()
      pkg/planner/core/common_plans.go:1183 +0x3e
  github.com/pingcap/tidb/pkg/executor.getBinaryPlan()
      pkg/executor/adapter.go:1752 +0xa4
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).SummaryStmt.func2()
      pkg/executor/adapter.go:1863 +0x49
  github.com/pingcap/tidb/pkg/util/stmtsummary.newStmtSummaryByDigestElement()
      pkg/util/stmtsummary/statement_summary.go:650 +0x125
  github.com/pingcap/tidb/pkg/util/stmtsummary.(*stmtSummaryByDigest).add.func1()
      pkg/util/stmtsummary/statement_summary.go:599 +0x284
  github.com/pingcap/tidb/pkg/util/stmtsummary.(*stmtSummaryByDigest).add()
      pkg/util/stmtsummary/statement_summary.go:610 +0x4e
  github.com/pingcap/tidb/pkg/util/stmtsummary.(*stmtSummaryByDigestMap).AddStatement()
      pkg/util/stmtsummary/statement_summary.go:353 +0x5a4
  github.com/pingcap/tidb/pkg/util/stmtsummary/v2.Add()
      pkg/util/stmtsummary/v2/stmtsummary.go:541 +0x99
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).SummaryStmt()
      pkg/executor/adapter.go:1962 +0x1b6b
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).FinishExecuteStmt()
      pkg/executor/adapter.go:1397 +0x5d9
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).CloseRecordSet()
      pkg/executor/adapter.go:1471 +0x4a
  github.com/pingcap/tidb/pkg/executor.(*recordSet).Close()
      pkg/executor/adapter.go:206 +0x219
  github.com/pingcap/tidb/pkg/session.(*execStmtResult).Close()
      pkg/session/session.go:2459 +0x93
  github.com/pingcap/tidb/pkg/util/sqlexec.RecordSet.Close-fm()
      <autogenerated>:1 +0x42
  github.com/pingcap/tidb/pkg/parser/terror.Call()
      pkg/parser/terror/terror.go:315 +0x3e
  github.com/pingcap/tidb/pkg/server/internal/resultset.(*tidbResultSet).Close()
      pkg/server/internal/resultset/resultset.go:78 +0xb8
  github.com/pingcap/tidb/pkg/server.(*clientConn).handleStmt.func2()
      pkg/server/conn.go:1981 +0x42
  runtime.deferreturn()
      GOROOT/src/runtime/panic.go:477 +0x30
  github.com/pingcap/tidb/pkg/server.(*clientConn).handleQuery()
      pkg/server/conn.go:1748 +0xd52
  github.com/pingcap/tidb/pkg/server.(*clientConn).dispatch()
      pkg/server/conn.go:1322 +0x1564
  github.com/pingcap/tidb/pkg/server.(*clientConn).Run()
      pkg/server/conn.go:1101 +0x844
  github.com/pingcap/tidb/pkg/server.(*Server).onConn()
      pkg/server/server.go:701 +0x15e4
  github.com/pingcap/tidb/pkg/server.(*Server).startNetworkListener.func2()
      pkg/server/server.go:517 +0x44
Goroutine 36524 (running) created at:
  github.com/pingcap/tidb/pkg/server.(*Server).startNetworkListener()
      pkg/server/server.go:517 +0x95e
  github.com/pingcap/tidb/pkg/server.(*Server).Run.func1()
      pkg/server/server.go:432 +0x64
Goroutine 37386 (running) created at:
  github.com/pingcap/tidb/pkg/server.(*Server).startNetworkListener()
      pkg/server/server.go:517 +0x95e
  github.com/pingcap/tidb/pkg/server.(*Server).Run.func1()
      pkg/server/server.go:432 +0x64
================== 

4. What is your TiDB version? (Required)

@hawkingrei hawkingrei added the type/bug The issue is confirmed as a bug. label Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-8.1 This bug affects the 8.1.x(LTS) versions. component/test may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants