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

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

Merged
merged 2 commits into from
Dec 4, 2019

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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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/[email protected]/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