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 TestFrameworkDeleteServer #44692

Closed
Tracked by #41316
ywqzzy opened this issue Jun 15, 2023 · 0 comments · Fixed by #44691
Closed
Tracked by #41316

Data Race in TestFrameworkDeleteServer #44692

ywqzzy opened this issue Jun 15, 2023 · 0 comments · Fixed by #44691
Labels
component/test severity/moderate type/bug The issue is confirmed as a bug.

Comments

@ywqzzy
Copy link
Contributor

ywqzzy commented Jun 15, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

go test -race -timeout 120s -tags intest,deadlock -run "^(TestFrameworkDeleteServer)$" github.com/pingcap/tidb/disttask/framework -v> log_all 2>&1

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

No race. Test passed.

3. What did you see instead (Required)

WARNING: DATA RACE
Read at 0x00c0001f4058 by goroutine 49939:
  github.com/dgraph-io/ristretto.(*Cache).Get()
      /Users/zzywq/.gvm/pkgsets/go1.20.4/global/pkg/mod/github.com/dgraph-io/ristretto@v0.1.1/cache.go:225 +0x44
  github.com/pingcap/tidb/store/copr.(*coprCache).Get()
      /Users/zzywq/code/tidb/store/copr/coprocessor_cache.go:164 +0x68
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).buildCacheKey()
      /Users/zzywq/code/tidb/store/copr/coprocessor.go:1578 +0x330
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTaskOnce()
      /Users/zzywq/code/tidb/store/copr/coprocessor.go:1149 +0x278
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTask()
      /Users/zzywq/code/tidb/store/copr/coprocessor.go:1106 +0x134
  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).run()
      /Users/zzywq/code/tidb/store/copr/coprocessor.go:799 +0xf8
  github.com/pingcap/tidb/store/copr.(*copIterator).open.func2()
      /Users/zzywq/code/tidb/store/copr/coprocessor.go:843 +0x4c

Previous write at 0x00c0001f4058 by goroutine 59:
  github.com/dgraph-io/ristretto.(*Cache).Close()
      /Users/zzywq/.gvm/pkgsets/go1.20.4/global/pkg/mod/github.com/dgraph-io/ristretto@v0.1.1/cache.go:363 +0xcc
  github.com/pingcap/tidb/store/copr.(*Store).Close()
      /Users/zzywq/code/tidb/store/copr/store.go:103 +0xc4
  github.com/pingcap/tidb/store/mockstore/mockstorage.(*mockStorage).Close()
      /Users/zzywq/code/tidb/store/mockstore/mockstorage/storage.go:120 +0x6c
  github.com/pingcap/tidb/testkit.(*DistExecutionTestContext).Close.func1()
      /Users/zzywq/code/tidb/testkit/mockstore.go:158 +0x1dc
  testing.(*common).Cleanup.func1()
      /Users/zzywq/.gvm/gos/go1.20.4/src/testing/testing.go:1150 +0x13c
  testing.(*common).runCleanup()
      /Users/zzywq/.gvm/gos/go1.20.4/src/testing/testing.go:1328 +0x148
  testing.tRunner.func2()
      /Users/zzywq/.gvm/gos/go1.20.4/src/testing/testing.go:1570 +0x48
  runtime.deferreturn()
      /Users/zzywq/.gvm/gos/go1.20.4/src/runtime/panic.go:476 +0x30
  github.com/pingcap/tidb/domain.(*Domain).LoadSysVarCacheLoop()
      /Users/zzywq/code/tidb/domain/domain.go:1631 +0x6c
  github.com/pingcap/tidb/session.bootstrapSessionImpl()
      /Users/zzywq/code/tidb/session/session.go:3356 +0x51c
  github.com/pingcap/tidb/domain.(*Domain).GetSessionCache()
      /Users/zzywq/code/tidb/domain/sysvar_cache.go:62 +0x38
  github.com/pingcap/tidb/session.(*session).loadCommonGlobalVariablesIfNeeded()
      /Users/zzywq/code/tidb/session/session.go:3720 +0xc4
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      /Users/zzywq/code/tidb/session/session.go:2129 +0xcc
  github.com/pingcap/tidb/session.(*session).ExecuteInternal()
      /Users/zzywq/code/tidb/session/session.go:1667 +0x1e0
  github.com/pingcap/tidb/domain.(*Domain).LoadPrivilegeLoop()
      /Users/zzywq/code/tidb/domain/domain.go:1574 +0xfc
  github.com/pingcap/tidb/session.bootstrapSessionImpl()
      /Users/zzywq/code/tidb/session/session.go:3349 +0x4e8
  github.com/pingcap/tidb/session.BootstrapSession4DistExecution()
      /Users/zzywq/code/tidb/session/session.go:3275 +0xa8
  github.com/pingcap/tidb/testkit.bootstrap4DistExecution()
      /Users/zzywq/code/tidb/testkit/mockstore.go:206 +0x94
  github.com/pingcap/tidb/testkit.NewDistExecutionTestContext()
      /Users/zzywq/code/tidb/testkit/mockstore.go:177 +0x1e8
  github.com/pingcap/tidb/sessionctx/variable.(*SysVar).ValidateWithRelaxedValidation()
      /Users/zzywq/code/tidb/sessionctx/variable/variable.go:361 +0x11c
  github.com/pingcap/tidb/domain.(*Domain).rebuildSysVarCache()
      /Users/zzywq/code/tidb/domain/sysvar_cache.go:146 +0x61c
  github.com/pingcap/tidb/domain.(*Domain).LoadSysVarCacheLoop()
      /Users/zzywq/code/tidb/domain/domain.go:1631 +0x6c
  github.com/pingcap/tidb/session.bootstrapSessionImpl()
      /Users/zzywq/code/tidb/session/session.go:3356 +0x51c
  github.com/pingcap/tidb/domain.(*Domain).GetSessionCache()
      /Users/zzywq/code/tidb/domain/sysvar_cache.go:62 +0x38
  github.com/pingcap/tidb/session.(*session).loadCommonGlobalVariablesIfNeeded()
      /Users/zzywq/code/tidb/session/session.go:3720 +0xc4
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      /Users/zzywq/code/tidb/session/session.go:2129 +0xcc
  github.com/pingcap/tidb/session.(*session).ExecuteInternal()
      /Users/zzywq/code/tidb/session/session.go:1667 +0x1e0
  github.com/pingcap/tidb/domain.(*Domain).LoadPrivilegeLoop()
      /Users/zzywq/code/tidb/domain/domain.go:1574 +0xfc
  github.com/pingcap/tidb/session.bootstrapSessionImpl()
      /Users/zzywq/code/tidb/session/session.go:3349 +0x4e8
  github.com/pingcap/tidb/session.BootstrapSession4DistExecution()
      /Users/zzywq/code/tidb/session/session.go:3275 +0xa8
  github.com/pingcap/tidb/testkit.bootstrap4DistExecution()
      /Users/zzywq/code/tidb/testkit/mockstore.go:206 +0x94
  github.com/pingcap/tidb/testkit.NewDistExecutionTestContext()
      /Users/zzywq/code/tidb/testkit/mockstore.go:177 +0x1e8
  github.com/pingcap/tidb/disttask/framework_test.TestFrameworkDeleteServer()
      /Users/zzywq/code/tidb/disttask/framework/framework_test.go:228 +0x90
  testing.tRunner()
      /Users/zzywq/.gvm/gos/go1.20.4/src/testing/testing.go:1576 +0x188
  testing.(*T).Run.func1()
      /Users/zzywq/.gvm/gos/go1.20.4/src/testing/testing.go:1629 +0x40

Goroutine 49939 (running) created at:
  github.com/pingcap/tidb/store/copr.(*copIterator).open()
      /Users/zzywq/code/tidb/store/copr/coprocessor.go:843 +0xc0
  github.com/pingcap/tidb/store/copr.(*CopClient).Send()
      /Users/zzywq/code/tidb/store/copr/coprocessor.go:100 +0x2c4
  github.com/pingcap/tidb/distsql.Select()
      /Users/zzywq/code/tidb/distsql/distsql.go:91 +0x5f0
  github.com/pingcap/tidb/distsql.SelectWithRuntimeStats()
      /Users/zzywq/code/tidb/distsql/distsql.go:146 +0x7c
  github.com/pingcap/tidb/executor.(*IndexLookUpExecutor).startIndexWorker.func1()
      /Users/zzywq/code/tidb/executor/distsql.go:730 +0x928

Goroutine 59 (running) created at:
  testing.(*T).Run()
      /Users/zzywq/.gvm/gos/go1.20.4/src/testing/testing.go:1629 +0x5e4
  testing.runTests.func1()
      /Users/zzywq/.gvm/gos/go1.20.4/src/testing/testing.go:2036 +0x80
  testing.tRunner()
      /Users/zzywq/.gvm/gos/go1.20.4/src/testing/testing.go:1576 +0x188
  testing.runTests()
      /Users/zzywq/.gvm/gos/go1.20.4/src/testing/testing.go:2034 +0x700
  testing.(*M).Run()
      /Users/zzywq/.gvm/gos/go1.20.4/src/testing/testing.go:1906 +0x950
  main.main()
      _testmain.go:57 +0x300
==================

4. What is your TiDB version? (Required)

master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/test severity/moderate type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants