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 buildSamplingStats #25270

Closed
Tracked by #25899
zhouqiang-cl opened this issue Jun 9, 2021 · 5 comments
Closed
Tracked by #25899

data race in buildSamplingStats #25270

zhouqiang-cl opened this issue Jun 9, 2021 · 5 comments
Assignees
Labels
severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@zhouqiang-cl
Copy link
Contributor

Bug Report

[2021-06-08T13:05:46.842Z] WARNING: DATA RACE
[2021-06-08T13:05:46.842Z] Read at 0x00c07d8b16d8 by goroutine 527:
[2021-06-08T13:05:46.842Z]   github.com/pingcap/tidb/executor.(*AnalyzeColumnsExec).buildSamplingStats()
[2021-06-08T13:05:46.842Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/analyze.go:891 +0x1164
[2021-06-08T13:05:46.842Z]   github.com/pingcap/tidb/executor.analyzeColumnsPushdown()
[2021-06-08T13:05:46.842Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/analyze.go:607 +0x853
[2021-06-08T13:05:46.842Z]   github.com/pingcap/tidb/executor.(*AnalyzeExec).analyzeWorker()
[2021-06-08T13:05:46.842Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/analyze.go:279 +0x3e4
[2021-06-08T13:05:46.842Z] 
[2021-06-08T13:05:46.842Z] Previous write at 0x00c07d8b16d8 by goroutine 795:
[2021-06-08T13:05:46.842Z]   github.com/pingcap/tidb/executor.(*AnalyzeColumnsExec).handleNDVForSpecialIndexes()
[2021-06-08T13:05:46.842Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/analyze.go:1028 +0x251
[2021-06-08T13:05:46.842Z] 
[2021-06-08T13:05:46.842Z] Goroutine 527 (running) created at:
[2021-06-08T13:05:46.842Z]   github.com/pingcap/tidb/executor.(*AnalyzeExec).Next()
[2021-06-08T13:05:46.842Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/analyze.go:93 +0x1c4
[2021-06-08T13:05:46.842Z]   github.com/pingcap/tidb/executor.Next()
[2021-06-08T13:05:46.842Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/executor.go:286 +0x2a8
[2021-06-08T13:05:46.842Z]   github.com/pingcap/tidb/executor.(*ExecStmt).handleNoDelayExecutor()
[2021-06-08T13:05:46.842Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/adapter.go:586 +0x3bc
[2021-06-08T13:05:46.842Z]   github.com/pingcap/tidb/executor.(*ExecStmt).handleNoDelay()
[2021-06-08T13:05:46.842Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/adapter.go:467 +0x276
[2021-06-08T13:05:46.843Z]   github.com/pingcap/tidb/executor.(*ExecStmt).Exec()
[2021-06-08T13:05:46.843Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/adapter.go:416 +0x63a
[2021-06-08T13:05:46.843Z]   github.com/pingcap/tidb/session.runStmt()
[2021-06-08T13:05:46.843Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/session/session.go:1653 +0x323
[2021-06-08T13:05:46.843Z]   github.com/pingcap/tidb/session.(*session).ExecuteStmt()
[2021-06-08T13:05:46.843Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/session/session.go:1548 +0xc37
[2021-06-08T13:05:46.843Z]   github.com/pingcap/tidb/util/testkit.(*TestKit).Exec()
[2021-06-08T13:05:46.843Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:170 +0x2fc
[2021-06-08T13:05:46.843Z]   github.com/pingcap/tidb/util/testkit.(*TestKit).MustExec()
[2021-06-08T13:05:46.843Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:216 +0x96
[2021-06-08T13:05:46.843Z]   github.com/pingcap/tidb/executor_test.(*testSuite1).TestAnalyzeFullSamplingOnIndexWithVirtualColumnOrPrefixColumn()
[2021-06-08T13:05:46.843Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/analyze_test.go:992 +0x1ec
[2021-06-08T13:05:46.843Z]   runtime.call16()
[2021-06-08T13:05:46.843Z]       /usr/local/go/src/runtime/asm_amd64.s:550 +0x3d
[2021-06-08T13:05:46.843Z]   reflect.Value.Call()
[2021-06-08T13:05:46.843Z]       /usr/local/go/src/reflect/value.go:337 +0xd8
[2021-06-08T13:05:46.843Z]   github.com/pingcap/check.(*suiteRunner).forkTest.func1()
[2021-06-08T13:05:46.843Z]       /nfs/cache/mod/github.com/pingcap/check@v0.0.0-20200212061837-5e12011dc712/check.go:850 +0xb3b
[2021-06-08T13:05:46.843Z]   github.com/pingcap/check.(*suiteRunner).forkCall.func1()
[2021-06-08T13:05:46.843Z]       /nfs/cache/mod/github.com/pingcap/check@v0.0.0-20200212061837-5e12011dc712/check.go:739 +0x11d
[2021-06-08T13:05:46.843Z] 
[2021-06-08T13:05:46.843Z] Goroutine 795 (running) created at:
[2021-06-08T13:05:46.843Z]   github.com/pingcap/tidb/executor.analyzeColumnsPushdown()
[2021-06-08T13:05:46.843Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/analyze.go:606 +0x7db
[2021-06-08T13:05:46.843Z]   github.com/pingcap/tidb/executor.(*AnalyzeExec).analyzeWorker()
[2021-06-08T13:05:46.843Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/analyze.go:279 +0x3e4

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

in ci https://ci.pingcap.net/blue/rest/organizations/jenkins/pipelines/tidb-unit-test-nightly/runs/276/nodes/104/steps/408/log/?start=0

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

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

master f81ef55

@zhouqiang-cl zhouqiang-cl added the type/bug The issue is confirmed as a bug. label Jun 9, 2021
@jingshanglu jingshanglu added the sig/execution SIG execution label Jun 9, 2021
@winoros
Copy link
Member

winoros commented Jun 10, 2021

This log is rather strange.
Line 891 is

err = e.decodeSampleDataWithVirtualColumn(rootRowCollector, fieldTps, virtualColIdx, e.schemaForVirtualColEval)

Line 1028 is

e.subIndexWorkerWg = &sync.WaitGroup{}

We found not see any chance that they might cause data race.

@winoros
Copy link
Member

winoros commented Jun 10, 2021

The lines' content would not change if we make failpoint-enable so we're curious how the data race happens.

@bb7133
Copy link
Member

bb7133 commented Jul 22, 2021

I think we can check if it is reproduced again.

@winoros
Copy link
Member

winoros commented Jul 28, 2021

@winoros winoros closed this as completed Jul 28, 2021
@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

7 participants