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 tidb/domain/domain.go:1336 #25898

Closed
Tracked by #25899
zhouqiang-cl opened this issue Jul 2, 2021 · 4 comments · Fixed by #27866
Closed
Tracked by #25899

data race in tidb/domain/domain.go:1336 #25898

zhouqiang-cl opened this issue Jul 2, 2021 · 4 comments · Fixed by #27866
Assignees
Labels
severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@zhouqiang-cl
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

[2021-07-01T21:16:43.031Z] ==================
[2021-07-01T21:16:43.031Z] WARNING: DATA RACE
[2021-07-01T21:16:43.031Z] Read at 0x00c004d7d728 by goroutine 107:
[2021-07-01T21:16:43.031Z]   github.com/pingcap/parser/types.(*FieldType).EvalType()
[2021-07-01T21:16:43.031Z]       /nfs/cache/mod/github.com/pingcap/[email protected]/types/field_type.go:96 +0x44
[2021-07-01T21:16:43.031Z]   github.com/pingcap/tidb/statistics.NewHistogram()
[2021-07-01T21:16:43.031Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/statistics/histogram.go:96 +0x80
[2021-07-01T21:16:43.031Z]   github.com/pingcap/tidb/statistics.PseudoTable()
[2021-07-01T21:16:43.031Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/statistics/table.go:688 +0x34c
[2021-07-01T21:16:43.031Z]   github.com/pingcap/tidb/statistics/handle.(*Handle).GetPartitionStats()
[2021-07-01T21:16:43.031Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/statistics/handle/handle.go:519 +0x159
[2021-07-01T21:16:43.031Z]   github.com/pingcap/tidb/statistics/handle.(*Handle).GetTableStats()
[2021-07-01T21:16:43.031Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/statistics/handle/handle.go:511 +0xe12
[2021-07-01T21:16:43.031Z]   github.com/pingcap/tidb/statistics/handle.(*Handle).HandleAutoAnalyze()
[2021-07-01T21:16:43.031Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/statistics/handle/update.go:944 +0xde3
[2021-07-01T21:16:43.031Z]   github.com/pingcap/tidb/domain.(*Domain).autoAnalyzeWorker()
[2021-07-01T21:16:43.031Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/domain/domain.go:1336 +0x2ea
[2021-07-01T21:16:43.031Z] 
[2021-07-01T21:16:43.031Z] Previous write at 0x00c004d7d728 by goroutine 87:
[2021-07-01T21:16:43.031Z]   [failed to restore the stack]
[2021-07-01T21:16:43.031Z] 
[2021-07-01T21:16:43.031Z] Goroutine 107 (running) created at:
[2021-07-01T21:16:43.031Z]   github.com/pingcap/tidb/domain.(*Domain).UpdateTableStatsLoop()
[2021-07-01T21:16:43.031Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/domain/domain.go:1170 +0x350
[2021-07-01T21:16:43.031Z]   github.com/pingcap/tidb/session.BootstrapSession()
[2021-07-01T21:16:43.031Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/session/session.go:2490 +0x653
[2021-07-01T21:16:43.031Z]   github.com/pingcap/tidb/table/tables_test.(*testSuite).SetUpSuite()
[2021-07-01T21:16:43.031Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/table/tables/tables_test.go:65 +0x15c
[2021-07-01T21:16:43.031Z]   runtime.call16()
[2021-07-01T21:16:43.031Z]       /usr/local/go/src/runtime/asm_amd64.s:550 +0x3d
[2021-07-01T21:16:43.031Z]   reflect.Value.Call()
[2021-07-01T21:16:43.031Z]       /usr/local/go/src/reflect/value.go:337 +0xd8
[2021-07-01T21:16:43.031Z]   github.com/pingcap/check.(*suiteRunner).runFixture.func1()
[2021-07-01T21:16:43.031Z]       /nfs/cache/mod/github.com/pingcap/[email protected]/check.go:799 +0x1d0
[2021-07-01T21:16:43.031Z]   github.com/pingcap/check.(*suiteRunner).forkCall.func1()
[2021-07-01T21:16:43.031Z]       /nfs/cache/mod/github.com/pingcap/[email protected]/check.go:739 +0x11d
[2021-07-01T21:16:43.031Z] 
[2021-07-01T21:16:43.031Z] Goroutine 87 (finished) created at:
[2021-07-01T21:16:43.031Z]   github.com/pingcap/tidb/executor.(*ProjectionExec).prepare()
[2021-07-01T21:16:43.031Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/projection.go:271 +0xd04
[2021-07-01T21:16:43.031Z]   github.com/pingcap/tidb/executor.(*ProjectionExec).parallelExecute()
[2021-07-01T21:16:43.031Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/projection.go:208 +0x5cb
[2021-07-01T21:16:43.031Z]   github.com/pingcap/tidb/executor.(*ProjectionExec).Next()
[2021-07-01T21:16:43.031Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/projection.go:181 +0x10d
[2021-07-01T21:16:43.031Z]   github.com/pingcap/tidb/executor.Next()
[2021-07-01T21:16:43.031Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/executor.go:286 +0x2a8
[2021-07-01T21:16:43.031Z]   github.com/pingcap/tidb/executor.(*recordSet).Next()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/adapter.go:145 +0x115
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/session.(*execStmtResult).Next()
[2021-07-01T21:16:43.032Z]       <autogenerated>:1 +0x84
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/session.GetRows4Test()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/session/tidb.go:307 +0x35e
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/session.ResultSetToStringSlice()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/session/tidb.go:325 +0xba
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/util/testkit.(*TestKit).ResultSetToResultWithCtx()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:389 +0xad
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/util/testkit.(*TestKit).ResultSetToResult()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:384 +0x566
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/util/testkit.(*TestKit).MustQuery()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:327 +0x571
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/table/tables_test.(*testSuite).TestViewColumns()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/table/tables/tables_test.go:739 +0x7b3
[2021-07-01T21:16:43.032Z]   runtime.call16()
[2021-07-01T21:16:43.032Z]       /usr/local/go/src/runtime/asm_amd64.s:550 +0x3d
[2021-07-01T21:16:43.032Z]   reflect.Value.Call()
[2021-07-01T21:16:43.032Z]       /usr/local/go/src/reflect/value.go:337 +0xd8
[2021-07-01T21:16:43.032Z]   github.com/pingcap/check.(*suiteRunner).forkTest.func1()
[2021-07-01T21:16:43.032Z]       /nfs/cache/mod/github.com/pingcap/[email protected]/check.go:850 +0xb3b
[2021-07-01T21:16:43.032Z]   github.com/pingcap/check.(*suiteRunner).forkCall.func1()
[2021-07-01T21:16:43.032Z]       /nfs/cache/mod/github.com/pingcap/[email protected]/check.go:739 +0x11d
[2021-07-01T21:16:43.032Z] ==================
[2021-07-01T21:16:43.032Z] ==================
[2021-07-01T21:16:43.032Z] WARNING: DATA RACE
[2021-07-01T21:16:43.032Z] Read at 0x00c004d7cfb0 by goroutine 107:
[2021-07-01T21:16:43.032Z]   github.com/pingcap/parser/types.(*FieldType).Clone()
[2021-07-01T21:16:43.032Z]       /nfs/cache/mod/github.com/pingcap/[email protected]/types/field_type.go:63 +0x3b5
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/statistics.NewHistogram()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/statistics/histogram.go:100 +0x4d4
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/statistics.PseudoTable()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/statistics/table.go:688 +0x34c
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/statistics/handle.(*Handle).GetPartitionStats()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/statistics/handle/handle.go:519 +0x159
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/statistics/handle.(*Handle).GetTableStats()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/statistics/handle/handle.go:511 +0xe12
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/statistics/handle.(*Handle).HandleAutoAnalyze()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/statistics/handle/update.go:944 +0xde3
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/domain.(*Domain).autoAnalyzeWorker()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/domain/domain.go:1336 +0x2ea
[2021-07-01T21:16:43.032Z] 
[2021-07-01T21:16:43.032Z] Previous write at 0x00c004d7cfb0 by goroutine 87:
[2021-07-01T21:16:43.032Z]   [failed to restore the stack]
[2021-07-01T21:16:43.032Z] 
[2021-07-01T21:16:43.032Z] Goroutine 107 (running) created at:
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/domain.(*Domain).UpdateTableStatsLoop()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/domain/domain.go:1170 +0x350
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/session.BootstrapSession()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/session/session.go:2490 +0x653
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/table/tables_test.(*testSuite).SetUpSuite()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/table/tables/tables_test.go:65 +0x15c
[2021-07-01T21:16:43.032Z]   runtime.call16()
[2021-07-01T21:16:43.032Z]       /usr/local/go/src/runtime/asm_amd64.s:550 +0x3d
[2021-07-01T21:16:43.032Z]   reflect.Value.Call()
[2021-07-01T21:16:43.032Z]       /usr/local/go/src/reflect/value.go:337 +0xd8
[2021-07-01T21:16:43.032Z]   github.com/pingcap/check.(*suiteRunner).runFixture.func1()
[2021-07-01T21:16:43.032Z]       /nfs/cache/mod/github.com/pingcap/[email protected]/check.go:799 +0x1d0
[2021-07-01T21:16:43.032Z]   github.com/pingcap/check.(*suiteRunner).forkCall.func1()
[2021-07-01T21:16:43.032Z]       /nfs/cache/mod/github.com/pingcap/[email protected]/check.go:739 +0x11d
[2021-07-01T21:16:43.032Z] 
[2021-07-01T21:16:43.032Z] Goroutine 87 (finished) created at:
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/executor.(*ProjectionExec).prepare()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/projection.go:271 +0xd04
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/executor.(*ProjectionExec).parallelExecute()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/projection.go:208 +0x5cb
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/executor.(*ProjectionExec).Next()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/projection.go:181 +0x10d
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/executor.Next()
[2021-07-01T21:16:43.032Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/executor.go:286 +0x2a8
[2021-07-01T21:16:43.032Z]   github.com/pingcap/tidb/executor.(*recordSet).Next()
[2021-07-01T21:16:43.033Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/adapter.go:145 +0x115
[2021-07-01T21:16:43.033Z]   github.com/pingcap/tidb/session.(*execStmtResult).Next()
[2021-07-01T21:16:43.033Z]       <autogenerated>:1 +0x84
[2021-07-01T21:16:43.033Z]   github.com/pingcap/tidb/session.GetRows4Test()
[2021-07-01T21:16:43.033Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/session/tidb.go:307 +0x35e
[2021-07-01T21:16:43.033Z]   github.com/pingcap/tidb/session.ResultSetToStringSlice()
[2021-07-01T21:16:43.033Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/session/tidb.go:325 +0xba
[2021-07-01T21:16:43.033Z]   github.com/pingcap/tidb/util/testkit.(*TestKit).ResultSetToResultWithCtx()
[2021-07-01T21:16:43.033Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:389 +0xad
[2021-07-01T21:16:43.033Z]   github.com/pingcap/tidb/util/testkit.(*TestKit).ResultSetToResult()
[2021-07-01T21:16:43.033Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:384 +0x566
[2021-07-01T21:16:43.033Z]   github.com/pingcap/tidb/util/testkit.(*TestKit).MustQuery()
[2021-07-01T21:16:43.033Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:327 +0x571
[2021-07-01T21:16:43.033Z]   github.com/pingcap/tidb/table/tables_test.(*testSuite).TestViewColumns()
[2021-07-01T21:16:43.033Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/table/tables/tables_test.go:739 +0x7b3
[2021-07-01T21:16:43.033Z]   runtime.call16()
[2021-07-01T21:16:43.033Z]       /usr/local/go/src/runtime/asm_amd64.s:550 +0x3d
[2021-07-01T21:16:43.033Z]   reflect.Value.Call()
[2021-07-01T21:16:43.033Z]       /usr/local/go/src/reflect/value.go:337 +0xd8
[2021-07-01T21:16:43.033Z]   github.com/pingcap/check.(*suiteRunner).forkTest.func1()
[2021-07-01T21:16:43.033Z]       /nfs/cache/mod/github.com/pingcap/[email protected]/check.go:850 +0xb3b
[2021-07-01T21:16:43.033Z]   github.com/pingcap/check.(*suiteRunner).forkCall.func1()
[2021-07-01T21:16:43.033Z]       /nfs/cache/mod/github.com/pingcap/[email protected]/check.go:739 +0x11d
[2021-07-01T21:16:43.033Z] ==================

1. Minimal reproduce step (Required)

in ci https://ci.pingcap.net/blue/rest/organizations/jenkins/pipelines/tidb-unit-test-nightly/runs/3334/nodes/116/steps/534/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

@bb7133
Copy link
Member

bb7133 commented Jul 5, 2021

PTAL @qw4990

@bb7133 bb7133 added sig/planner SIG: Planner and removed sig/execution SIG execution labels Jul 5, 2021
@zhouqiang-cl
Copy link
Contributor Author

@qw4990
Copy link
Contributor

qw4990 commented Jul 26, 2021

I guess this issue has the same cause as #26539. Seems like it is caused by some functions related to view like tryFillViewColumnType modifying column types.

@qw4990 qw4990 assigned XuHuaiyu and unassigned qw4990 Jul 26, 2021
@XuHuaiyu XuHuaiyu assigned lzmhhh123, XuHuaiyu and wzru and unassigned XuHuaiyu and lzmhhh123 Jul 27, 2021
@qw4990 qw4990 self-assigned this Aug 19, 2021
@qw4990 qw4990 added sig/execution SIG execution and removed sig/planner SIG: Planner labels Aug 19, 2021
@qw4990 qw4990 assigned XuHuaiyu and unassigned qw4990 Aug 19, 2021
@github-actions
Copy link

github-actions bot commented Sep 8, 2021

Please check whether the issue should be labeled with 'affects-x.y' or 'backport-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
severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
7 participants