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 the TestTiDBBindingInListToVer175 #48953

Closed
Tracked by #41316
hawkingrei opened this issue Nov 28, 2023 · 1 comment · Fixed by #48966
Closed
Tracked by #41316

DATA RACE in the TestTiDBBindingInListToVer175 #48953

hawkingrei opened this issue Nov 28, 2023 · 1 comment · Fixed by #48966
Labels
affects-7.5 severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@hawkingrei
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

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

3. What did you see instead (Required)

==================

WARNING: DATA RACE

Write at 0x00c005cc8c3b by goroutine 92:

  github.com/pingcap/tidb/pkg/session.(*session).ExecuteInternal()

      pkg/session/session.go:1583 +0x10c

  github.com/pingcap/tidb/pkg/session.mustExecute()

      pkg/session/bootstrap.go:3175 +0x132

  github.com/pingcap/tidb/pkg/session.upgradeToVer175()

      pkg/session/bootstrap.go:2835 +0xfc4

  github.com/pingcap/tidb/pkg/session.upgrade()

      pkg/session/bootstrap.go:1288 +0x6f5

  github.com/pingcap/tidb/pkg/session.runInBootstrapSession()

      pkg/session/session.go:3516 +0x25d

  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()

      pkg/session/session.go:3294 +0x2c4

  github.com/pingcap/tidb/pkg/session.BootstrapSession()

      pkg/session/session.go:3258 +0x504

  github.com/pingcap/tidb/pkg/session.TestTiDBBindingInListToVer175()

      pkg/session/bootstrap_test.go:2040 +0x4e5

  github.com/pingcap/tidb/pkg/sessionctx/variable.(*SysVar).ValidateWithRelaxedValidation()

      pkg/sessionctx/variable/variable.go:366 +0x1c4

  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()

      pkg/domain/sysvar_cache.go:146 +0x8c4

  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadSysVarCacheLoop()

      pkg/domain/domain.go:1714 +0x93

  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()

      pkg/session/session.go:3344 +0x704

  github.com/pingcap/tidb/pkg/domain.(*Domain).GetSessionCache()

      pkg/domain/sysvar_cache.go:62 +0x50

  github.com/pingcap/tidb/pkg/session.(*session).loadCommonGlobalVariablesIfNeeded()

      pkg/session/session.go:3716 +0xf4

  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt()

      pkg/session/session.go:2086 +0x135

  github.com/pingcap/tidb/pkg/session.(*session).ExecuteInternal()

      pkg/session/session.go:1599 +0x312

  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadPrivilegeLoop()

      pkg/domain/domain.go:1657 +0x108

  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()

      pkg/session/session.go:3337 +0x6a4

  github.com/pingcap/tidb/pkg/session.BootstrapSession()

      pkg/session/session.go:3258 +0x6f

  github.com/pingcap/tidb/pkg/session.CreateStoreAndBootstrap()

      pkg/session/testutil.go:46 +0x59

  github.com/pingcap/tidb/pkg/session.TestTiDBBindingInListToVer175()

      pkg/session/bootstrap_test.go:1991 +0x3e

  testing.tRunner()

      GOROOT/src/testing/testing.go:1595 +0x238

  testing.(*T).Run.func1()

      GOROOT/src/testing/testing.go:1648 +0x44


Previous read at 0x00c005cc8c3b by goroutine 41101:

  github.com/pingcap/tidb/pkg/distsql.(*selectResult).fetchResp.func1()

      pkg/distsql/select_result.go:326 +0x90

  runtime.deferreturn()

      GOROOT/src/runtime/panic.go:477 +0x30

  github.com/pingcap/tidb/pkg/distsql.(*selectResult).Next()

      pkg/distsql/select_result.go:421 +0x191

  github.com/pingcap/tidb/pkg/executor.(*tableResultHandler).nextChunk()

      pkg/executor/table_reader.go:533 +0x1a6

  github.com/pingcap/tidb/pkg/executor.(*TableReaderExecutor).Next()

      pkg/executor/table_reader.go:251 +0x33a

  github.com/pingcap/tidb/pkg/executor/internal/exec.Next()

      pkg/executor/internal/exec/executor.go:289 +0x326

  github.com/pingcap/tidb/pkg/executor.(*projectionInputFetcher).run()

      pkg/executor/projection.go:390 +0x5e4

  github.com/pingcap/tidb/pkg/executor.(*ProjectionExec).prepare.func1()

      pkg/executor/projection.go:279 +0x4f


Goroutine 92 (running) created at:

  testing.(*T).Run()

      GOROOT/src/testing/testing.go:1648 +0x82a

  testing.runTests.func1()

      GOROOT/src/testing/testing.go:2054 +0x84

  testing.tRunner()

      GOROOT/src/testing/testing.go:1595 +0x238

  testing.runTests()

      GOROOT/src/testing/testing.go:2052 +0x896

  testing.(*M).Run()

      GOROOT/src/testing/testing.go:1925 +0xb57

  github.com/pingcap/tidb/pkg/testkit/testmain.(*testingM).Run()

      pkg/testkit/testmain/wrapper.go:27 +0x43

  go.uber.org/goleak.VerifyTestMain()

      external/org_uber_go_goleak/testmain.go:53 +0x64

  github.com/pingcap/tidb/pkg/session.TestMain()

      pkg/session/main_test.go:66 +0xe0e

  main.main()

      bazel-out/k8-fastbuild/bin/pkg/session/session_test_/testmain.go:301 +0x78e


Goroutine 41101 (finished) created at:

  github.com/pingcap/tidb/pkg/executor.(*ProjectionExec).prepare()

      pkg/executor/projection.go:279 +0xdaf

  github.com/pingcap/tidb/pkg/executor.(*ProjectionExec).parallelExecute()

      pkg/executor/projection.go:214 +0xdb

  github.com/pingcap/tidb/pkg/executor.(*ProjectionExec).Next()

      pkg/executor/projection.go:187 +0xc8

  github.com/pingcap/tidb/pkg/executor/internal/exec.Next()

      pkg/executor/internal/exec/executor.go:289 +0x326

  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).next()

      pkg/executor/adapter.go:1226 +0x84

  github.com/pingcap/tidb/pkg/executor.(*recordSet).Next()

      pkg/executor/adapter.go:154 +0x14e

  github.com/pingcap/tidb/pkg/session.(*execStmtResult).Next()

      <autogenerated>:1 +0x6c

  github.com/pingcap/tidb/pkg/session.upgradeToVer175()

      pkg/session/bootstrap.go:2820 +0x40e

  github.com/pingcap/tidb/pkg/session.upgrade()

      pkg/session/bootstrap.go:1288 +0x6f5

  github.com/pingcap/tidb/pkg/session.runInBootstrapSession()

      pkg/session/session.go:3516 +0x25d

  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()

      pkg/session/session.go:3294 +0x2c4

  github.com/pingcap/tidb/pkg/session.BootstrapSession()

      pkg/session/session.go:3258 +0x504

  github.com/pingcap/tidb/pkg/session.TestTiDBBindingInListToVer175()

      pkg/session/bootstrap_test.go:2040 +0x4e5

  github.com/pingcap/tidb/pkg/sessionctx/variable.(*SysVar).ValidateWithRelaxedValidation()

      pkg/sessionctx/variable/variable.go:366 +0x1c4

  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()

      pkg/domain/sysvar_cache.go:146 +0x8c4

  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadSysVarCacheLoop()

      pkg/domain/domain.go:1714 +0x93

  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()

      pkg/session/session.go:3344 +0x704

  github.com/pingcap/tidb/pkg/domain.(*Domain).GetSessionCache()

      pkg/domain/sysvar_cache.go:62 +0x50

  github.com/pingcap/tidb/pkg/session.(*session).loadCommonGlobalVariablesIfNeeded()

      pkg/session/session.go:3716 +0xf4

  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt()

      pkg/session/session.go:2086 +0x135

  github.com/pingcap/tidb/pkg/session.(*session).ExecuteInternal()

      pkg/session/session.go:1599 +0x312

  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadPrivilegeLoop()

      pkg/domain/domain.go:1657 +0x108

  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()

      pkg/session/session.go:3337 +0x6a4

  github.com/pingcap/tidb/pkg/session.BootstrapSession()

      pkg/session/session.go:3258 +0x6f

  github.com/pingcap/tidb/pkg/session.CreateStoreAndBootstrap()

      pkg/session/testutil.go:46 +0x59

  github.com/pingcap/tidb/pkg/session.TestTiDBBindingInListToVer175()

      pkg/session/bootstrap_test.go:1991 +0x3e

  testing.tRunner()

      GOROOT/src/testing/testing.go:1595 +0x238

  testing.(*T).Run.func1()

      GOROOT/src/testing/testing.go:1648 +0x44

==================

4. What is your TiDB version? (Required)

@D3Hunter
Copy link
Contributor

in upgradeToVer175, we shouldn't reuse the same session to run update, while another query is on-going

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

Successfully merging a pull request may close this issue.

3 participants