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 session.(*session).useCurrentSession() #49113

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

DATA RACE in the session.(*session).useCurrentSession() #49113

hawkingrei opened this issue Dec 4, 2023 · 1 comment · Fixed by #49164
Labels
component/test 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
Read at 0x00c006512048 by goroutine 48669:
  github.com/pingcap/tidb/pkg/session.(*session).useCurrentSession()
      pkg/session/session.go:1923 +0x5ac
  github.com/pingcap/tidb/pkg/session.(*session).withRestrictedSQLExecutor()
      pkg/session/session.go:2011 +0x1c4
  github.com/pingcap/tidb/pkg/session.(*session).ExecRestrictedSQL()
      pkg/session/session.go:2031 +0x129
  github.com/pingcap/tidb/pkg/bindinfo.execRows()
      pkg/bindinfo/util.go:44 +0x1d2
  github.com/pingcap/tidb/pkg/bindinfo.(*BindHandle).Update()
      pkg/bindinfo/handle.go:137 +0x19a
  github.com/pingcap/tidb/pkg/domain.(*Domain).globalBindHandleWorkerLoop.func1()
      pkg/domain/domain.go:1878 +0x304
  github.com/pingcap/tidb/pkg/util.(*WaitGroupEnhancedWrapper).Run.func1()
      pkg/util/wait_group_wrapper.go:99 +0xd0
Previous write at 0x00c006512048 by goroutine 114:
  github.com/pingcap/tidb/pkg/executor.ResetContextOfStmt()
      pkg/executor/executor.go:2083 +0x1c24
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt()
      pkg/session/session.go:2094 +0x25d
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteInternal()
      pkg/session/session.go:1599 +0x35a
  github.com/pingcap/tidb/pkg/bindinfo.exec()
      pkg/bindinfo/util.go:35 +0x125
  github.com/pingcap/tidb/pkg/bindinfo.(*BindHandle).lockBindInfoTable()
      pkg/bindinfo/handle.go:523 +0x88
  github.com/pingcap/tidb/pkg/bindinfo.(*BindHandle).CreateGlobalBinding()
      pkg/bindinfo/handle.go:222 +0x2ab
  github.com/pingcap/tidb/pkg/executor.(*SQLBindExec).createSQLBind()
      pkg/executor/bind.go:164 +0x674
  github.com/pingcap/tidb/pkg/executor.(*SQLBindExec).Next()
      pkg/executor/bind.go:52 +0x94
  github.com/pingcap/tidb/pkg/executor/internal/exec.Next()
      pkg/executor/internal/exec/executor.go:289 +0x3b5
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).next()
      pkg/executor/adapter.go:1226 +0x94
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).handleNoDelayExecutor()
      pkg/executor/adapter.go:971 +0x559
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).handleNoDelay()
      pkg/executor/adapter.go:797 +0x41b
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).Exec()
      pkg/executor/adapter.go:578 +0x1437
  github.com/pingcap/tidb/pkg/session.runStmt()
      pkg/session/session.go:2393 +0x7c1
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt()
      pkg/session/session.go:2235 +0x1ec4
  github.com/pingcap/tidb/pkg/testkit.(*TestKit).ExecWithContext()
      pkg/testkit/testkit.go:364 +0x8eb
  github.com/pingcap/tidb/pkg/testkit.(*TestKit).MustExecWithContext()
      pkg/testkit/testkit.go:136 +0xbc
  github.com/pingcap/tidb/pkg/testkit.(*TestKit).MustExec()
      pkg/testkit/testkit.go:131 +0x134
  pkg/bindinfo/tests/tests_test.TestDropBindBySQLDigest()
      pkg/bindinfo/tests/bind_test.go:799 +0x335
  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadSysVarCacheLoop()
      pkg/domain/domain.go:1714 +0xa4
  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()
      pkg/session/session.go:3344 +0x7aa
  github.com/pingcap/tidb/pkg/session.(*session).withRestrictedSQLExecutor()
      pkg/session/session.go:2027 +0x3a5
  github.com/pingcap/tidb/pkg/session.(*session).ExecRestrictedSQL()
      pkg/session/session.go:2031 +0x129
  github.com/pingcap/tidb/pkg/bindinfo.execRows()
      pkg/bindinfo/util.go:44 +0x1d2
  github.com/pingcap/tidb/pkg/bindinfo.(*BindHandle).Update()
      pkg/bindinfo/handle.go:137 +0x19a
  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadBindInfoLoop()
      pkg/domain/domain.go:1848 +0x14e
  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()
      pkg/session/session.go:3331 +0x6a4
  github.com/pingcap/tidb/pkg/session.BootstrapSession()
      pkg/session/session.go:3258 +0x4b
  github.com/pingcap/tidb/pkg/testkit.bootstrap()
      pkg/testkit/mockstore.go:227 +0x86
  github.com/pingcap/tidb/pkg/testkit.CreateMockStoreAndDomain()
      pkg/testkit/mockstore.go:200 +0xde
  pkg/bindinfo/tests/tests_test.TestDropBindBySQLDigest()
      pkg/bindinfo/tests/bind_test.go:748 +0x4c
  testing.tRunner()
      GOROOT/src/testing/testing.go:1595 +0x238
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1648 +0x44
Goroutine 48669 (running) created at:
  github.com/pingcap/tidb/pkg/util.(*WaitGroupEnhancedWrapper).Run()
      pkg/util/wait_group_wrapper.go:94 +0x164
  github.com/pingcap/tidb/pkg/domain.(*Domain).globalBindHandleWorkerLoop()
      pkg/domain/domain.go:1859 +0x126
  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadBindInfoLoop()
      pkg/domain/domain.go:1854 +0x1dc
  github.com/pingcap/tidb/pkg/session.(*session).ExecRestrictedSQL.func1()
      pkg/session/session.go:2041 +0x38c
  github.com/pingcap/tidb/pkg/session.(*session).withRestrictedSQLExecutor()
      pkg/session/session.go:2027 +0x3a5
  github.com/pingcap/tidb/pkg/session.(*session).ExecRestrictedSQL()
      pkg/session/session.go:2031 +0x129
  github.com/pingcap/tidb/pkg/bindinfo.execRows()
      pkg/bindinfo/util.go:44 +0x1d2
  github.com/pingcap/tidb/pkg/bindinfo.(*BindHandle).Update()
      pkg/bindinfo/handle.go:137 +0x19a
  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadBindInfoLoop()
      pkg/domain/domain.go:1848 +0x14e
  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()
      pkg/session/session.go:3331 +0x6a4
  github.com/pingcap/tidb/pkg/session.BootstrapSession()
      pkg/session/session.go:3258 +0x4b
  github.com/pingcap/tidb/pkg/testkit.bootstrap()
      pkg/testkit/mockstore.go:227 +0x86
  github.com/pingcap/tidb/pkg/testkit.CreateMockStoreAndDomain()
      pkg/testkit/mockstore.go:200 +0xde
  pkg/bindinfo/tests/tests_test.TestDropBindBySQLDigest()
      pkg/bindinfo/tests/bind_test.go:748 +0x4c
  testing.tRunner()
      GOROOT/src/testing/testing.go:1595 +0x238
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1648 +0x44
Goroutine 114 (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
  pkg/bindinfo/tests/tests_test.TestMain()
      pkg/bindinfo/tests/main_test.go:32 +0x3d2
  main.main()
      bazel-out/k8-fastbuild/bin/pkg/bindinfo/tests/tests_test_/testmain.go:168 +0x8f6
================== 

4. What is your TiDB version? (Required)

@hawkingrei hawkingrei added the type/bug The issue is confirmed as a bug. label Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/test 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.

4 participants