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:read/write LocalTemporaryTables in infoschema #42307

Closed
Tracked by #41316
zimulala opened this issue Mar 16, 2023 · 0 comments · Fixed by #42566
Closed
Tracked by #41316

DATA RACE:read/write LocalTemporaryTables in infoschema #42307

zimulala opened this issue Mar 16, 2023 · 0 comments · Fixed by #42566
Labels

Comments

@zimulala
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

https://do.pingcap.net/jenkins/blue/organizations/jenkins/pingcap%2Ftidb%2Fghpr_mysql_test/detail/ghpr_mysql_test/17462/pipeline

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

No data race

3. What did you see instead (Required)

WARNING: DATA RACE

Read at 0x00c018d38d10 by goroutine 1134771:

  github.com/pingcap/tidb/infoschema.(*SessionExtendedInfoSchema).TableByName()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/infoschema/infoschema.go:684 +0xaf

  github.com/pingcap/tidb/executor.getAutoIncrementID()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/infoschema_reader.go:384 +0x137

  github.com/pingcap/tidb/executor.(*memtableRetriever).setDataFromTables()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/infoschema_reader.go:688 +0xc74

  github.com/pingcap/tidb/executor.(*memtableRetriever).retrieve()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/infoschema_reader.go:111 +0x893

  github.com/pingcap/tidb/executor.(*MemTableReaderExec).Next()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/memtable_reader.go:117 +0x443

  github.com/pingcap/tidb/executor.Next()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/executor.go:326 +0x326

  github.com/pingcap/tidb/executor.(*SelectionExec).Next()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/executor.go:1663 +0x208

  github.com/pingcap/tidb/executor.Next()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/executor.go:326 +0x326

  github.com/pingcap/tidb/executor.(*buildWorker).fetchBuildSideRows()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/join.go:320 +0x2c4

  github.com/pingcap/tidb/executor.(*HashJoinExec).fetchAndBuildHashTable.func2()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/join.go:1166 +0x124

  github.com/pingcap/tidb/util.(*WaitGroupWrapper).RunWithRecover.func1()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/util/wait_group_wrapper.go:172 +0x9e



Previous write at 0x00c018d38d10 by goroutine 1134768:

  github.com/pingcap/tidb/table/temptable.DetachLocalTemporaryTableInfoSchema()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/table/temptable/infoschema.go:45 +0x2da

  github.com/pingcap/tidb/planner/core.(*PlanBuilder).buildDataSource()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/planner/core/logical_plan_builder.go:4480 +0x314

  github.com/pingcap/tidb/planner/core.(*PlanBuilder).buildResultSetNode()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/planner/core/logical_plan_builder.go:384 +0x26c

  github.com/pingcap/tidb/planner/core.(*PlanBuilder).buildJoin()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/planner/core/logical_plan_builder.go:838 +0x1d5

  github.com/pingcap/tidb/planner/core.(*PlanBuilder).buildResultSetNode()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/planner/core/logical_plan_builder.go:371 +0xf4

  github.com/pingcap/tidb/planner/core.(*PlanBuilder).buildTableRefs()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/planner/core/logical_plan_builder.go:363 +0x104

  github.com/pingcap/tidb/planner/core.(*PlanBuilder).buildSelect()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/planner/core/logical_plan_builder.go:4030 +0xcf5

  github.com/pingcap/tidb/planner/core.(*PlanBuilder).Build()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/planner/core/planbuilder.go:815 +0xd76

  github.com/pingcap/tidb/planner/core.(*PlanBuilder).BuildDataSourceFromView()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/planner/core/logical_plan_builder.go:5182 +0x126c

  github.com/pingcap/tidb/executor.(*hugeMemTableRetriever).dataForColumnsInTable.func1()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/infoschema_reader.go:837 +0x195

  github.com/pingcap/tidb/executor.runWithSystemSession()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/show.go:2248 +0x16a

  github.com/pingcap/tidb/executor.(*hugeMemTableRetriever).dataForColumnsInTable()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/infoschema_reader.go:834 +0x2ae

  github.com/pingcap/tidb/executor.(*hugeMemTableRetriever).setDataForColumns()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/infoschema_reader.go:815 +0x426

  github.com/pingcap/tidb/executor.(*hugeMemTableRetriever).retrieve()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/infoschema_reader.go:2954 +0x2e4

  github.com/pingcap/tidb/executor.(*MemTableReaderExec).Next()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/memtable_reader.go:117 +0x443

  github.com/pingcap/tidb/executor.Next()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/executor.go:326 +0x326

  github.com/pingcap/tidb/executor.(*SelectionExec).Next()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/executor.go:1663 +0x208

  github.com/pingcap/tidb/executor.Next()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/executor.go:326 +0x326

  github.com/pingcap/tidb/executor.(*probeSideTupleFetcher).fetchProbeSideChunks()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/join.go:250 +0x2d3

  github.com/pingcap/tidb/executor.(*HashJoinExec).fetchAndProbeHashTable.func1()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/executor/join.go:378 +0xfe

  github.com/pingcap/tidb/util.(*WaitGroupWrapper).RunWithRecover.func1()

      /home/jenkins/agent/workspace/pingcap/tidb/ghpr_mysql_test/tidb/util/wait_group_wrapper.go:172 +0x9e

4. What is your TiDB version? (Required)

master
Found this issue in PR: #42264

@zimulala zimulala added the type/bug The issue is confirmed as a bug. label Mar 16, 2023
@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.1 may-affects-6.5 labels Mar 21, 2023
@hawkingrei hawkingrei added affects-6.1 affects-6.5 and 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. labels Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants