Skip to content

executor: fix data race in TestFastAnalyze (#12910)#13872

Merged
sre-bot merged 2 commits intopingcap:release-3.0from
sre-bot:release-3.0-d6270085f48c
Dec 4, 2019
Merged

executor: fix data race in TestFastAnalyze (#12910)#13872
sre-bot merged 2 commits intopingcap:release-3.0from
sre-bot:release-3.0-d6270085f48c

Conversation

@sre-bot
Copy link
Contributor

@sre-bot sre-bot commented Dec 3, 2019

cherry-pick #12910 to release-3.0


What problem does this PR solve?

Fix a data race.

[2019-10-23T13:18:58.735Z] ==================
[2019-10-23T13:18:58.735Z] WARNING: DATA RACE
[2019-10-23T13:18:58.735Z] Write at 0x000004641498 by goroutine 595:
[2019-10-23T13:18:58.735Z]   github.com/pingcap/tidb/executor_test.(*testFastAnalyze).TestFastAnalyze()
[2019-10-23T13:18:58.735Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/session/tidb.go:134 +0x273
[2019-10-23T13:18:58.735Z]   runtime.call32()
[2019-10-23T13:18:58.735Z]       /usr/local/go/src/runtime/asm_amd64.s:539 +0x3a
[2019-10-23T13:18:58.735Z]   reflect.Value.Call()
[2019-10-23T13:18:58.735Z]       /usr/local/go/src/reflect/value.go:321 +0xd3
[2019-10-23T13:18:58.735Z]   github.com/pingcap/check.(*suiteRunner).forkTest.func1()
[2019-10-23T13:18:58.735Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/pingcap/check@v0.0.0-20190102082844-67f458068fc8/check.go:836 +0x9aa
[2019-10-23T13:18:58.735Z]   github.com/pingcap/check.(*suiteRunner).forkCall.func1()
[2019-10-23T13:18:58.735Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/pingcap/check@v0.0.0-20190102082844-67f458068fc8/check.go:730 +0xc4
[2019-10-23T13:18:58.735Z] 
[2019-10-23T13:18:58.735Z] Previous read at 0x000004641498 by goroutine 504:
[2019-10-23T13:18:58.735Z]   github.com/pingcap/tidb/session.(*domainMap).Get()
[2019-10-23T13:18:58.735Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/session/tidb.go:68 +0x1d4
[2019-10-23T13:18:58.735Z]   github.com/pingcap/tidb/session.createSession()
[2019-10-23T13:18:58.735Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/session/session.go:1670 +0x7c
[2019-10-23T13:18:58.736Z]   github.com/pingcap/tidb/session.runInBootstrapSession()
[2019-10-23T13:18:58.736Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/session/session.go:1653 +0x60
[2019-10-23T13:18:58.736Z]   github.com/pingcap/tidb/session.BootstrapSession()
[2019-10-23T13:18:58.736Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/session/session.go:1574 +0x9fa
[2019-10-23T13:18:58.736Z]   github.com/pingcap/tidb/executor_test.(*testBypassSuite).TestLatch()
[2019-10-23T13:18:58.736Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/write_test.go:2142 +0x18b
[2019-10-23T13:18:58.736Z]   runtime.call32()
[2019-10-23T13:18:58.736Z]       /usr/local/go/src/runtime/asm_amd64.s:539 +0x3a
[2019-10-23T13:18:58.736Z]   reflect.Value.Call()
[2019-10-23T13:18:58.736Z]       /usr/local/go/src/reflect/value.go:321 +0xd3
[2019-10-23T13:18:58.736Z]   github.com/pingcap/check.(*suiteRunner).forkTest.func1()
[2019-10-23T13:18:58.736Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/pingcap/check@v0.0.0-20190102082844-67f458068fc8/check.go:836 +0x9aa
[2019-10-23T13:18:58.736Z]   github.com/pingcap/check.(*suiteRunner).forkCall.func1()
[2019-10-23T13:18:58.736Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/pingcap/check@v0.0.0-20190102082844-67f458068fc8/check.go:730 +0xc4
[2019-10-23T13:18:58.736Z] 
[2019-10-23T13:18:58.736Z] Goroutine 595 (running) created at:
[2019-10-23T13:18:58.736Z]   github.com/pingcap/check.(*suiteRunner).forkCall()
[2019-10-23T13:18:58.736Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/pingcap/check@v0.0.0-20190102082844-67f458068fc8/check.go:727 +0x4a3
[2019-10-23T13:18:58.736Z]   github.com/pingcap/check.(*suiteRunner).forkTest()
[2019-10-23T13:18:58.736Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/pingcap/check@v0.0.0-20190102082844-67f458068fc8/check.go:818 +0x1b9
[2019-10-23T13:18:58.736Z]   github.com/pingcap/check.(*suiteRunner).doRun()
[2019-10-23T13:18:58.736Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/pingcap/check@v0.0.0-20190102082844-67f458068fc8/check.go:659 +0x13a
[2019-10-23T13:18:58.736Z]   github.com/pingcap/check.(*suiteRunner).asyncRun.func1()
[2019-10-23T13:18:58.736Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/pingcap/check@v0.0.0-20190102082844-67f458068fc8/check.go:643 +0xae
[2019-10-23T13:18:58.736Z] 
[2019-10-23T13:18:58.736Z] Goroutine 504 (running) created at:
[2019-10-23T13:18:58.736Z]   github.com/pingcap/check.(*suiteRunner).forkCall()
[2019-10-23T13:18:58.736Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/pingcap/check@v0.0.0-20190102082844-67f458068fc8/check.go:727 +0x4a3
[2019-10-23T13:18:58.736Z]   github.com/pingcap/check.(*suiteRunner).forkTest()
[2019-10-23T13:18:58.736Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/pingcap/check@v0.0.0-20190102082844-67f458068fc8/check.go:818 +0x1b9
[2019-10-23T13:18:58.736Z]   github.com/pingcap/check.(*suiteRunner).doRun()
[2019-10-23T13:18:58.736Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/pingcap/check@v0.0.0-20190102082844-67f458068fc8/check.go:659 +0x13a
[2019-10-23T13:18:58.736Z]   github.com/pingcap/check.(*suiteRunner).asyncRun.func1()
[2019-10-23T13:18:58.736Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/pingcap/check@v0.0.0-20190102082844-67f458068fc8/check.go:643 +0xae
[2019-10-23T13:18:58.736Z] ==================

What is changed and how it works?

Use atomic to get/set the global value.

Check List

Tests

  • None

@sre-bot
Copy link
Contributor Author

sre-bot commented Dec 3, 2019

/run-all-tests

Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bb7133 bb7133 added the status/LGT2 Indicates that a PR has LGTM 2. label Dec 4, 2019
@bb7133 bb7133 added the status/can-merge Indicates a PR has been approved by a committer. label Dec 4, 2019
@sre-bot
Copy link
Contributor Author

sre-bot commented Dec 4, 2019

/run-all-tests

@sre-bot sre-bot merged commit ab73fde into pingcap:release-3.0 Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/test status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants