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 variable.(*RewritePhaseInfo).Reset() #49088

Closed
Tracked by #41316
hawkingrei opened this issue Dec 1, 2023 · 1 comment · Fixed by #49092
Closed
Tracked by #41316

DATA RACE in the variable.(*RewritePhaseInfo).Reset() #49088

hawkingrei opened this issue Dec 1, 2023 · 1 comment · Fixed by #49092
Labels
affects-7.5 This bug affects the 7.5.x(LTS) versions. severity/moderate 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 0x00c009912568 by goroutine 32913:

  github.com/pingcap/tidb/pkg/sessionctx/variable.(*RewritePhaseInfo).Reset()

      pkg/sessionctx/variable/session.go:536 +0x29a

  github.com/pingcap/tidb/pkg/planner.buildLogicalPlan()

      pkg/planner/optimize.go:564 +0x22b

  github.com/pingcap/tidb/pkg/planner.optimize()

      pkg/planner/optimize.go:484 +0xc49

  github.com/pingcap/tidb/pkg/planner.Optimize()

      pkg/planner/optimize.go:352 +0x28f7

  github.com/pingcap/tidb/pkg/executor.(*Compiler).Compile()

      pkg/executor/compiler.go:104 +0x7e4

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

      pkg/session/session.go:2175 +0xe25

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

      pkg/session/session.go:2076 +0x1a9

  github.com/pingcap/tidb/pkg/session.(*session).ExecRestrictedSQL.func1()

      pkg/session/session.go:2041 +0x2ac

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

      pkg/session/session.go:2027 +0x375

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

      pkg/session/session.go:2031 +0x118

  github.com/pingcap/tidb/pkg/bindinfo.execRows()

      pkg/bindinfo/util.go:44 +0x1b7

  github.com/pingcap/tidb/pkg/bindinfo.(*BindHandle).extractCaptureFilterFromStorage()

      pkg/bindinfo/capture.go:93 +0x13a

  github.com/pingcap/tidb/pkg/bindinfo.(*BindHandle).CaptureBaselines()

      pkg/bindinfo/capture.go:134 +0x4b

  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadBindInfoLoop.(*Domain).globalBindHandleWorkerLoop.func1()

      pkg/domain/domain.go:1886 +0x447

  github.com/pingcap/tidb/pkg/util.(*WaitGroupEnhancedWrapper).Run.func1()

      pkg/util/wait_group_wrapper.go:99 +0xad


Previous write at 0x00c009912568 by goroutine 86:

  github.com/pingcap/tidb/pkg/sessionctx/variable.(*RewritePhaseInfo).Reset()

      pkg/sessionctx/variable/session.go:536 +0x29a

  github.com/pingcap/tidb/pkg/planner.buildLogicalPlan()

      pkg/planner/optimize.go:564 +0x22b

  github.com/pingcap/tidb/pkg/planner.optimize()

      pkg/planner/optimize.go:484 +0xc49

  github.com/pingcap/tidb/pkg/planner.Optimize()

      pkg/planner/optimize.go:352 +0x28f7

  github.com/pingcap/tidb/pkg/executor.(*Compiler).Compile()

      pkg/executor/compiler.go:104 +0x7e4

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

      pkg/session/session.go:2175 +0xe25

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

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

  github.com/pingcap/tidb/pkg/bindinfo.exec()

      pkg/bindinfo/util.go:35 +0x102

  github.com/pingcap/tidb/pkg/bindinfo.(*BindHandle).CreateGlobalBinding()

      pkg/bindinfo/handle.go:216 +0x1cd

  github.com/pingcap/tidb/pkg/bindinfo.(*BindHandle).CaptureBaselines()

      pkg/bindinfo/capture.go:188 +0x1432

  github.com/pingcap/tidb/pkg/executor.(*SQLBindExec).captureBindings()

      pkg/executor/bind.go:172 +0x73

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

      pkg/executor/bind.go:60 +0x2a4

  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.(*ExecStmt).handleNoDelayExecutor()

      pkg/executor/adapter.go:971 +0x4da

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

      pkg/executor/adapter.go:797 +0x364

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

      pkg/executor/adapter.go:578 +0x1268

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

      pkg/session/session.go:2393 +0x6b3

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

      pkg/session/session.go:2235 +0x1a18

  github.com/pingcap/tidb/pkg/testkit.(*TestKit).ExecWithContext()

      pkg/testkit/testkit.go:364 +0x829

  github.com/pingcap/tidb/pkg/testkit.(*TestKit).MustExecWithContext()

      pkg/testkit/testkit.go:136 +0xab

  github.com/pingcap/tidb/pkg/testkit.(*TestKit).MustExec()

      pkg/testkit/testkit.go:131 +0x10d

  github.com/pingcap/tidb/pkg/bindinfo_test.TestCaptureWildcardFilter.func3()

      pkg/bindinfo/capture_test.go:701 +0x2ad

  github.com/pingcap/tidb/pkg/bindinfo_test.TestCaptureWildcardFilter()

      pkg/bindinfo/capture_test.go:766 +0x1278

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

      pkg/session/session.go:2393 +0x6b3

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

      pkg/session/session.go:2235 +0x1a18

  github.com/pingcap/tidb/pkg/testkit.(*TestKit).ExecWithContext()

      pkg/testkit/testkit.go:364 +0x829

  github.com/pingcap/tidb/pkg/testkit.(*TestKit).MustExecWithContext()

      pkg/testkit/testkit.go:136 +0xab

  github.com/pingcap/tidb/pkg/testkit.(*TestKit).MustExec()

      pkg/testkit/testkit.go:131 +0x10d

  github.com/pingcap/tidb/pkg/bindinfo_test.TestCaptureWildcardFilter()

      pkg/bindinfo/capture_test.go:669 +0xb1

  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/session.(*session).withRestrictedSQLExecutor()

      pkg/session/session.go:2027 +0x375

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

      pkg/session/session.go:2031 +0x118

  github.com/pingcap/tidb/pkg/bindinfo.execRows()

      pkg/bindinfo/util.go:44 +0x1b7

  github.com/pingcap/tidb/pkg/bindinfo.(*BindHandle).Update()

      pkg/bindinfo/handle.go:143 +0x17b

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

      pkg/domain/domain.go:1848 +0x1ae

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

      pkg/session/session.go:3331 +0x604

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

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

  github.com/pingcap/tidb/pkg/testkit.bootstrap()

      pkg/testkit/mockstore.go:227 +0x94

  github.com/pingcap/tidb/pkg/testkit.CreateMockStoreAndDomain()

      pkg/testkit/mockstore.go:200 +0xd5

  github.com/pingcap/tidb/pkg/bindinfo_test.TestCaptureWildcardFilter()

      pkg/bindinfo/capture_test.go:665 +0x4c

  testing.tRunner()

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

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

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


Goroutine 32913 (running) created at:

  github.com/pingcap/tidb/pkg/util.(*WaitGroupEnhancedWrapper).Run()

      pkg/util/wait_group_wrapper.go:94 +0x145

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

      pkg/domain/domain.go:1859 +0x2f7

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

      pkg/domain/domain.go:1854 +0x215

  github.com/pingcap/tidb/pkg/session.(*session).ExecRestrictedSQL.func1()

      pkg/session/session.go:2041 +0x2ac

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

      pkg/session/session.go:2027 +0x375

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

      pkg/session/session.go:2031 +0x118

  github.com/pingcap/tidb/pkg/bindinfo.execRows()

      pkg/bindinfo/util.go:44 +0x1b7

  github.com/pingcap/tidb/pkg/bindinfo.(*BindHandle).Update()

      pkg/bindinfo/handle.go:143 +0x17b

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

      pkg/domain/domain.go:1848 +0x1ae

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

      pkg/session/session.go:3331 +0x604

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

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

  github.com/pingcap/tidb/pkg/testkit.bootstrap()

      pkg/testkit/mockstore.go:227 +0x94

  github.com/pingcap/tidb/pkg/testkit.CreateMockStoreAndDomain()

      pkg/testkit/mockstore.go:200 +0xd5

  github.com/pingcap/tidb/pkg/bindinfo_test.TestCaptureWildcardFilter()

      pkg/bindinfo/capture_test.go:665 +0x4c

  testing.tRunner()

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

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

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


Goroutine 86 (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

  go.uber.org/goleak.VerifyTestMain()

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

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

      pkg/bindinfo/main_test.go:32 +0x3d2

  main.main()

      bazel-out/k8-fastbuild/bin/pkg/bindinfo/bindinfo_test_/testmain.go:217 +0x78e

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

4. What is your TiDB version? (Required)

@hawkingrei hawkingrei added the type/bug The issue is confirmed as a bug. label Dec 1, 2023
@hawkingrei hawkingrei changed the title DATA RACE DATA RACE in the variable.(*RewritePhaseInfo).Reset() Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.5 This bug affects the 7.5.x(LTS) versions. severity/moderate 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.

2 participants