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 sessionctx/variable.(*SessionVars).InitStatementContext #27114

Closed
Tracked by #25899
zhouqiang-cl opened this issue Aug 11, 2021 · 2 comments
Closed
Tracked by #25899
Labels
component/test 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-08-11T08:33:28.493Z] WARNING: DATA RACE
[2021-08-11T08:33:28.493Z] Write at 0x00c0889e3a68 by goroutine 341:
[2021-08-11T08:33:28.493Z]   github.com/pingcap/tidb/sessionctx/variable.(*SessionVars).InitStatementContext()
[2021-08-11T08:33:28.493Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/sessionctx/variable/session.go:896 +0x3312
[2021-08-11T08:33:28.493Z]   github.com/pingcap/tidb/executor.ResetContextOfStmt()
[2021-08-11T08:33:28.493Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/executor.go:1662 +0x3386
[2021-08-11T08:33:28.493Z]   github.com/pingcap/tidb/session.(*session).ExecuteStmt()
[2021-08-11T08:33:28.493Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/session/session.go:1633 +0x204
[2021-08-11T08:33:28.493Z]   github.com/pingcap/tidb/util/testkit.(*TestKit).Exec()
[2021-08-11T08:33:28.493Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:170 +0x2fc
[2021-08-11T08:33:28.493Z]   github.com/pingcap/tidb/util/testkit.(*TestKit).MustExec()
[2021-08-11T08:33:28.493Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:216 +0x96
[2021-08-11T08:33:28.493Z]   github.com/pingcap/tidb/ddl_test.(*testSerialSuite).TestIssue23872()
[2021-08-11T08:33:28.493Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/ddl/db_test.go:7206 +0x6b7
[2021-08-11T08:33:28.493Z]   runtime.call16()
[2021-08-11T08:33:28.493Z]       /usr/local/go/src/runtime/asm_amd64.s:550 +0x3d
[2021-08-11T08:33:28.493Z]   reflect.Value.Call()
[2021-08-11T08:33:28.493Z]       /usr/local/go/src/reflect/value.go:337 +0xd8
[2021-08-11T08:33:28.493Z]   github.com/pingcap/check.(*suiteRunner).forkTest.func1()
[2021-08-11T08:33:28.493Z]       /nfs/cache/mod/github.com/pingcap/check@v0.0.0-20200212061837-5e12011dc712/check.go:850 +0xb3b
[2021-08-11T08:33:28.493Z]   github.com/pingcap/check.(*suiteRunner).forkCall.func1()
[2021-08-11T08:33:28.493Z]       /nfs/cache/mod/github.com/pingcap/check@v0.0.0-20200212061837-5e12011dc712/check.go:739 +0x11d
[2021-08-11T08:33:28.493Z] 
[2021-08-11T08:33:28.493Z] Previous write at 0x00c0889e3a68 by goroutine 179:
[2021-08-11T08:33:28.493Z]   sync/atomic.AddInt32()
[2021-08-11T08:33:28.493Z]       /usr/local/go/src/runtime/race_amd64.s:292 +0xb
[2021-08-11T08:33:28.493Z]   sync.(*Mutex).Unlock()
[2021-08-11T08:33:28.493Z]       /usr/local/go/src/sync/mutex.go:186 +0x51
[2021-08-11T08:33:28.493Z]   github.com/pingcap/tidb/util/memory.(*Tracker).getParent()
[2021-08-11T08:33:28.493Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/util/memory/tracker.go:506 +0xa4
[2021-08-11T08:33:28.493Z]   github.com/pingcap/tidb/util/memory.(*Tracker).Consume()
[2021-08-11T08:33:28.493Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/util/memory/tracker.go:312 +0x9d
[2021-08-11T08:33:28.493Z]   github.com/pingcap/tidb/store/copr.(*copIteratorWorker).sendToRespCh()
[2021-08-11T08:33:28.493Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/store/copr/coprocessor.go:517 +0x290
[2021-08-11T08:33:28.493Z]   github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleCopResponse()
[2021-08-11T08:33:28.493Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/store/copr/coprocessor.go:979 +0xc39
[2021-08-11T08:33:28.493Z]   github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTaskOnce()
[2021-08-11T08:33:28.493Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/store/copr/coprocessor.go:748 +0x1264
[2021-08-11T08:33:28.493Z]   github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTask()
[2021-08-11T08:33:28.493Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/store/copr/coprocessor.go:640 +0x1e4
[2021-08-11T08:33:28.493Z]   github.com/pingcap/tidb/store/copr.(*copIteratorWorker).run()
[2021-08-11T08:33:28.493Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/store/copr/coprocessor.go:377 +0x15a
[2021-08-11T08:33:28.493Z] 
[2021-08-11T08:33:28.493Z] Goroutine 341 (running) created at:
[2021-08-11T08:33:28.493Z]   github.com/pingcap/check.(*suiteRunner).forkCall()
[2021-08-11T08:33:28.493Z]       /nfs/cache/mod/github.com/pingcap/check@v0.0.0-20200212061837-5e12011dc712/check.go:734 +0x4cc
[2021-08-11T08:33:28.493Z]   github.com/pingcap/check.(*suiteRunner).forkTest()
[2021-08-11T08:33:28.493Z]       /nfs/cache/mod/github.com/pingcap/check@v0.0.0-20200212061837-5e12011dc712/check.go:832 +0x1c4
[2021-08-11T08:33:28.493Z]   github.com/pingcap/check.(*suiteRunner).doRun()
[2021-08-11T08:33:28.493Z]       /nfs/cache/mod/github.com/pingcap/check@v0.0.0-20200212061837-5e12011dc712/check.go:666 +0x144
[2021-08-11T08:33:28.493Z]   github.com/pingcap/check.(*suiteRunner).run()
[2021-08-11T08:33:28.493Z]       /nfs/cache/mod/github.com/pingcap/check@v0.0.0-20200212061837-5e12011dc712/check.go:696 +0x144
[2021-08-11T08:33:28.493Z]   github.com/pingcap/check.Run()
[2021-08-11T08:33:28.493Z]       /nfs/cache/mod/github.com/pingcap/check@v0.0.0-20200212061837-5e12011dc712/run.go:150 +0x5a
[2021-08-11T08:33:28.493Z]   github.com/pingcap/check.RunAll()
[2021-08-11T08:33:28.493Z]       /nfs/cache/mod/github.com/pingcap/check@v0.0.0-20200212061837-5e12011dc712/run.go:136 +0x968
[2021-08-11T08:33:28.493Z]   github.com/pingcap/check.TestingT()
[2021-08-11T08:33:28.493Z]       /nfs/cache/mod/github.com/pingcap/check@v0.0.0-20200212061837-5e12011dc712/run.go:99 +0x756
[2021-08-11T08:33:28.493Z]   github.com/pingcap/tidb/ddl.TestT()
[2021-08-11T08:33:28.493Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/ddl/ddl_test.go:93 +0x3aa
[2021-08-11T08:33:28.494Z]   testing.tRunner()
[2021-08-11T08:33:28.494Z]       /usr/local/go/src/testing/testing.go:1193 +0x202
[2021-08-11T08:33:28.494Z] 
[2021-08-11T08:33:28.494Z] Goroutine 179 (finished) created at:
[2021-08-11T08:33:28.494Z]   github.com/pingcap/tidb/store/copr.(*copIterator).open()
[2021-08-11T08:33:28.494Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/store/copr/coprocessor.go:414 +0xe7
[2021-08-11T08:33:28.494Z]   github.com/pingcap/tidb/store/copr.(*CopClient).Send()
[2021-08-11T08:33:28.494Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/store/copr/coprocessor.go:127 +0xc49
[2021-08-11T08:33:28.494Z]   github.com/pingcap/tidb/distsql.Select()
[2021-08-11T08:33:28.494Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/distsql/distsql.go:77 +0x328
[2021-08-11T08:33:28.494Z]   github.com/pingcap/tidb/distsql.SelectWithRuntimeStats()
[2021-08-11T08:33:28.494Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/distsql/distsql.go:126 +0xbd
[2021-08-11T08:33:28.494Z]   github.com/pingcap/tidb/executor.selectResultHook.SelectResult()
[2021-08-11T08:33:28.494Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/table_reader.go:51 +0x22b
[2021-08-11T08:33:28.494Z]   github.com/pingcap/tidb/executor.(*TableReaderExecutor).buildResp()
[2021-08-11T08:33:28.494Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/table_reader.go:303 +0xa15
[2021-08-11T08:33:28.494Z]   github.com/pingcap/tidb/executor.(*TableReaderExecutor).Open()
[2021-08-11T08:33:28.494Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/table_reader.go:197 +0xba6
[2021-08-11T08:33:28.494Z]   github.com/pingcap/tidb/executor.(*ExecStmt).Exec()
[2021-08-11T08:33:28.494Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/adapter.go:388 +0x4e2
[2021-08-11T08:33:28.494Z]   github.com/pingcap/tidb/session.runStmt()
[2021-08-11T08:33:28.494Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/session/session.go:1783 +0x323
[2021-08-11T08:33:28.494Z]   github.com/pingcap/tidb/session.(*session).ExecuteStmt()
[2021-08-11T08:33:28.494Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/session/session.go:1677 +0xcd7
[2021-08-11T08:33:28.494Z]   github.com/pingcap/tidb/util/testkit.(*TestKit).Exec()
[2021-08-11T08:33:28.494Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:170 +0x2fc
[2021-08-11T08:33:28.494Z]   github.com/pingcap/tidb/ddl_test.(*testSerialSuite).TestIssue23872()
[2021-08-11T08:33:28.494Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/ddl/db_test.go:7194 +0x1fb
[2021-08-11T08:33:28.494Z]   runtime.call16()
[2021-08-11T08:33:28.494Z]       /usr/local/go/src/runtime/asm_amd64.s:550 +0x3d
[2021-08-11T08:33:28.494Z]   reflect.Value.Call()
[2021-08-11T08:33:28.494Z]       /usr/local/go/src/reflect/value.go:337 +0xd8
[2021-08-11T08:33:28.494Z]   github.com/pingcap/check.(*suiteRunner).forkTest.func1()
[2021-08-11T08:33:28.494Z]       /nfs/cache/mod/github.com/pingcap/check@v0.0.0-20200212061837-5e12011dc712/check.go:850 +0xb3b
[2021-08-11T08:33:28.494Z]   github.com/pingcap/check.(*suiteRunner).forkCall.func1()
[2021-08-11T08:33:28.494Z]       /nfs/cache/mod/github.com/pingcap/check@v0.0.0-20200212061837-5e12011dc712/check.go:739 +0x11d
[2021-08-11T08:33:28.494Z] ==================
[2021-08-11T08:33:28.494Z] ==================
[2021-08-11T08:33:28.494Z] WARNING: DATA RACE
[2021-08-11T08:33:28.494Z] Write at 0x00c0889e3a70 by goroutine 341:
[2021-08-11T08:33:28.494Z]   github.com/pingcap/tidb/sessionctx/variable.(*SessionVars).InitStatementContext()
[2021-08-11T08:33:28.494Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/sessionctx/variable/session.go:896 +0x3312
[2021-08-11T08:33:28.494Z]   github.com/pingcap/tidb/executor.ResetContextOfStmt()
[2021-08-11T08:33:28.494Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/executor/executor.go:1662 +0x3386
[2021-08-11T08:33:28.494Z]   github.com/pingcap/tidb/session.(*session).ExecuteStmt()
[2021-08-11T08:33:28.494Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/session/session.go:1633 +0x204
[2021-08-11T08:33:28.494Z]   github.com/pingcap/tidb/util/testkit.(*TestKit).Exec()
[2021-08-11T08:33:28.494Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:170 +0x2fc
[2021-08-11T08:33:28.494Z]   github.com/pingcap/tidb/util/testkit.(*TestKit).MustExec()
[2021-08-11T08:33:28.494Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:216 +0x96
[2021-08-11T08:33:28.494Z]   github.com/pingcap/tidb/ddl_test.(*testSerialSuite).TestIssue23872()
[2021-08-11T08:33:28.494Z]       /home/jenkins/agent/workspace/tidb-unit-test-nightly/go/src/github.com/pingcap/tidb/ddl/db_test.go:7206 +0x6b7
[2021-08-11T08:33:28.494Z]   runtime.call16()
[2021-08-11T08:33:28.494Z]       /usr/local/go/src/runtime/asm_amd64.s:550 +0x3d
[2021-08-11T08:33:28.494Z]   reflect.Value.Call()
[2021-08-11T08:33:28.494Z]       /usr/local/go/src/reflect/value.go:337 +0xd8
[2021-08-11T08:33:28.494Z]   github.com/pingcap/check.(*suiteRunner).forkTest.func1()
[2021-08-11T08:33:28.494Z]       /nfs/cache/mod/github.com/pingcap/check@v0.0.0-20200212061837-5e12011dc712/check.go:850 +0xb3b
[2021-08-11T08:33:28.494Z]   github.com/pingcap/check.(*suiteRunner).forkCall.func1()
[2021-08-11T08:33:28.494Z]       /nfs/cache/mod/github.com/pingcap/check@v0.0.0-20200212061837-5e12011dc712/check.go:739 +0x11d

1. Minimal reproduce step (Required)

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

@hawkingrei
Copy link
Member

Close by #30355.

@github-actions
Copy link

github-actions bot commented Dec 7, 2021

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
component/test severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

4 participants