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 SessionVars.InRestrictedSQL #30918

Closed
hawkingrei opened this issue Dec 21, 2021 · 3 comments · Fixed by #31058
Closed

DATA RACE in the SessionVars.InRestrictedSQL #30918

hawkingrei opened this issue Dec 21, 2021 · 3 comments · Fixed by #31058
Labels
affects-5.4 This bug affects 5.4.x versions. component/test severity/major type/bug The issue is confirmed as a bug.

Comments

@hawkingrei
Copy link
Member

hawkingrei commented Dec 21, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

make race

WARNING: DATA RACE
Read at 0x00c001752e3b by goroutine 70:
  github.com/pingcap/tidb/distsql.(*selectResult).fetchResp.func1()
      /go/tidb/distsql/select_result.go:164 +0x18f
  github.com/pingcap/tidb/distsql.(*selectResult).fetchResp()
      /go/tidb/distsql/select_result.go:251 +0xcd7
  github.com/pingcap/tidb/distsql.(*selectResult).Next()
      /go/tidb/distsql/select_result.go:257 +0xfa
  github.com/pingcap/tidb/executor.(*tableResultHandler).nextChunk()
      /go/tidb/executor/table_reader.go:433 +0x1a8
  github.com/pingcap/tidb/executor.(*TableReaderExecutor).Next()
      /go/tidb/executor/table_reader.go:234 +0x304
  github.com/pingcap/tidb/executor.Next()
      /go/tidb/executor/executor.go:286 +0x58f
  github.com/pingcap/tidb/executor.(*HashJoinExec).fetchProbeSideChunks()
      /go/tidb/executor/join.go:214 +0x2d6
  github.com/pingcap/tidb/executor.(*HashJoinExec).fetchAndProbeHashTable.func1()
      /go/tidb/executor/join.go:338 +0xc8
  github.com/pingcap/tidb/util.WithRecovery()
      /go/tidb/util/misc.go:100 +0x77
  github.com/pingcap/tidb/executor.(*HashJoinExec).fetchAndProbeHashTable·dwrap·82()
      /go/tidb/executor/join.go:336 +0x47
Previous write at 0x00c001752e3b by goroutine 78:
  github.com/pingcap/tidb/session.(*session).ParseWithParamsInternal()
      /go/tidb/session/session.go:1532 +0x10e
  github.com/pingcap/tidb/executor.getRowCountAllTable()
      /go/tidb/executor/infoschema_reader.go:193 +0xad
  github.com/pingcap/tidb/executor.(*statsCache).get()
      /go/tidb/executor/infoschema_reader.go:299 +0x1d1
  github.com/pingcap/tidb/executor.(*memtableRetriever).setDataFromTables()
      /go/tidb/executor/infoschema_reader.go:520 +0xb0
  github.com/pingcap/tidb/executor.(*memtableRetriever).retrieve()
      /go/tidb/executor/infoschema_reader.go:107 +0x824
  github.com/pingcap/tidb/executor.(*MemTableReaderExec).Next()
      /go/tidb/executor/memtable_reader.go:119 +0x407
  github.com/pingcap/tidb/executor.Next()
      /go/tidb/executor/executor.go:286 +0x58f
  github.com/pingcap/tidb/executor.(*SelectionExec).Next()
      /go/tidb/executor/executor.go:1329 +0x1d8
  github.com/pingcap/tidb/executor.Next()
      /go/tidb/executor/executor.go:286 +0x58f
  github.com/pingcap/tidb/executor.(*HashJoinExec).fetchBuildSideRows()
      /go/tidb/executor/join.go:282 +0x39d
  github.com/pingcap/tidb/executor.(*HashJoinExec).fetchAndBuildHashTable.func2()
      /go/tidb/executor/join.go:731 +0xf6
  github.com/pingcap/tidb/util.WithRecovery()
      /go/tidb/util/misc.go:100 +0x77
  github.com/pingcap/tidb/executor.(*HashJoinExec).fetchAndBuildHashTable·dwrap·90()
      /go/tidb/executor/join.go:728 +0x47
Goroutine 70 (running) created at:
  github.com/pingcap/tidb/executor.(*HashJoinExec).fetchAndProbeHashTable()
      /go/tidb/executor/join.go:336 +0x288
  github.com/pingcap/tidb/executor.(*HashJoinExec).Next()
      /go/tidb/executor/join.go:689 +0x1225
  github.com/pingcap/tidb/executor.Next()
      /go/tidb/executor/executor.go:286 +0x58f
  github.com/pingcap/tidb/executor.(*HashJoinExec).fetchProbeSideChunks()
      /go/tidb/executor/join.go:214 +0x2d6
  github.com/pingcap/tidb/executor.(*HashJoinExec).fetchAndProbeHashTable.func1()
      /go/tidb/executor/join.go:338 +0xc8
  github.com/pingcap/tidb/util.WithRecovery()
      /go/tidb/util/misc.go:100 +0x77
  github.com/pingcap/tidb/executor.(*HashJoinExec).fetchAndProbeHashTable·dwrap·82()
      /go/tidb/executor/join.go:336 +0x47
Goroutine 78 (running) created at:
  github.com/pingcap/tidb/executor.(*HashJoinExec).fetchAndBuildHashTable()
      /go/tidb/executor/join.go:728 +0x3d7
  github.com/pingcap/tidb/executor.(*HashJoinExec).Next.func1()
      /go/tidb/executor/join.go:687 +0xc8
  github.com/pingcap/tidb/util.WithRecovery()
      /go/tidb/util/misc.go:100 +0x77
  github.com/pingcap/tidb/executor.(*HashJoinExec).Next·dwrap·88()
      /go/tidb/executor/join.go:685 +0x47 

https://prow.hawkingrei.com/view/gs/prowpingcap/logs/tidb_race/1473216687745536000

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 Dec 21, 2021
@hawkingrei hawkingrei changed the title DATA RACE in the InRestrictedSQL DATA RACE in the SessionVars.InRestrictedSQL Dec 21, 2021
@Defined2014
Copy link
Contributor

/label affects-5.4

@ti-chi-bot
Copy link
Member

@Defined2014: The label(s) affects-5.4 cannot be applied. These labels are supported: challenge-program, compatibility-breaker, first-time-contributor, contribution, require-LGT3, good first issue, correctness, duplicate, proposal, security, needs-more-info, needs-cherry-pick-3.0, needs-cherry-pick-3.1, needs-cherry-pick-4.0, needs-cherry-pick-5.0, needs-cherry-pick-5.1, needs-cherry-pick-5.2, needs-cherry-pick-5.3, needs-cherry-pick-5.4, affects-4.0, affects-5.0, affects-5.1, affects-5.2, affects-5.3, backport-4.0.14, backport-4.0.15, backport-5.0.3, backport-5.0.4, backport-5.1.0, backport-5.1.1, backport-5.1.2.

In response to this:

/label affects-5.4

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@djshow832 djshow832 added the affects-5.4 This bug affects 5.4.x versions. label Jan 6, 2022
@github-actions
Copy link

github-actions bot commented Jan 6, 2022

Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.4 This bug affects 5.4.x versions. component/test severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
5 participants