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 ristretto #41846

Closed
Tracked by #41316
hawkingrei opened this issue Mar 2, 2023 · 1 comment · Fixed by #44691
Closed
Tracked by #41316

DATA RACE in the ristretto #41846

hawkingrei opened this issue Mar 2, 2023 · 1 comment · Fixed by #44691
Labels

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 0x00c01ac38058 by goroutine 79206:

  github.com/dgraph-io/ristretto.(*Cache).Get()

      external/com_github_dgraph_io_ristretto/cache.go:225 +0x4d

  github.com/pingcap/tidb/store/copr.(*coprCache).Get()

      store/copr/coprocessor_cache.go:164 +0xa4

  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).buildCacheKey()

      store/copr/coprocessor.go:1524 +0x409

  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTaskOnce()

      store/copr/coprocessor.go:1136 +0x4d9

  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTask()

      store/copr/coprocessor.go:1093 +0x224

  github.com/pingcap/tidb/store/copr.(*copIteratorWorker).run()

      store/copr/coprocessor.go:789 +0x1e4

  github.com/pingcap/tidb/store/copr.(*copIterator).open.func1()

      store/copr/coprocessor.go:833 +0x58


Previous write at 0x00c01ac38058 by goroutine 46613:

  github.com/dgraph-io/ristretto.(*Cache).Close()

      external/com_github_dgraph_io_ristretto/cache.go:363 +0xf2

  github.com/pingcap/tidb/store/copr.(*Store).Close()

      store/copr/store.go:102 +0x98

  github.com/pingcap/tidb/store/mockstore/mockstorage.(*mockStorage).Close()

      store/mockstore/mockstorage/storage.go:116 +0x58

  github.com/pingcap/tidb/server.createTidbTestSuiteWithCfg.func2()

      server/tidb_test.go:128 +0xed

  testing.(*common).Cleanup.func1()

      GOROOT/src/testing/testing.go:1150 +0x193

  testing.(*common).runCleanup()

      GOROOT/src/testing/testing.go:1328 +0x1e9

  testing.tRunner.func2()

      GOROOT/src/testing/testing.go:1570 +0x52

  runtime.deferCallSave()

      GOROOT/src/runtime/panic.go:796 +0x87

  testing.(*T).FailNow()

      <autogenerated>:1 +0x37

  github.com/stretchr/testify/require.Greaterf()

      external/com_github_stretchr_testify/require/require.go:560 +0x12d

  github.com/pingcap/tidb/server.TestTopSQLCPUProfile.func3()

      server/tidb_test.go:1400 +0x119

  github.com/pingcap/tidb/server.TestTopSQLCPUProfile.func5()

      server/tidb_test.go:1448 +0x95

  github.com/pingcap/tidb/server.(*tidbTestTopSQLSuite).testCase()

      server/tidb_test.go:1712 +0x22b

  github.com/pingcap/tidb/server.TestTopSQLCPUProfile()

      server/tidb_test.go:1451 +0x9cd

  github.com/pingcap/failpoint.parseTerm()

      external/com_github_pingcap_failpoint/terms.go:149 +0x389

  github.com/pingcap/failpoint.parse()

      external/com_github_pingcap_failpoint/terms.go:126 +0xad

  github.com/pingcap/failpoint.newTerms()

      external/com_github_pingcap_failpoint/terms.go:98 +0x50

  github.com/pingcap/failpoint.(*Failpoint).Enable()

      external/com_github_pingcap_failpoint/failpoint.go:54 +0x44

  github.com/pingcap/failpoint.(*Failpoints).Enable()

      external/com_github_pingcap_failpoint/failpoints.go:105 +0x276

  github.com/pingcap/failpoint.Enable()

      external/com_github_pingcap_failpoint/failpoints.go:222 +0x277

  github.com/pingcap/tidb/server.TestTopSQLCPUProfile()

      server/tidb_test.go:1372 +0x278

  github.com/pingcap/failpoint.parseTerm()

      external/com_github_pingcap_failpoint/terms.go:149 +0x389

  github.com/pingcap/failpoint.parse()

      external/com_github_pingcap_failpoint/terms.go:126 +0xad

  github.com/pingcap/failpoint.newTerms()

      external/com_github_pingcap_failpoint/terms.go:98 +0x50

  github.com/pingcap/failpoint.(*Failpoint).Enable()

      external/com_github_pingcap_failpoint/failpoint.go:54 +0x44

  github.com/pingcap/failpoint.(*Failpoints).Enable()

      external/com_github_pingcap_failpoint/failpoints.go:105 +0x276

  github.com/pingcap/failpoint.Enable()

      external/com_github_pingcap_failpoint/failpoints.go:222 +0x231

  github.com/pingcap/tidb/server.TestTopSQLCPUProfile()

      server/tidb_test.go:1371 +0x232

  github.com/pingcap/failpoint.parseTerm()

      external/com_github_pingcap_failpoint/terms.go:149 +0x389

  github.com/pingcap/failpoint.parse()

      external/com_github_pingcap_failpoint/terms.go:126 +0xad

  github.com/pingcap/failpoint.newTerms()

      external/com_github_pingcap_failpoint/terms.go:98 +0x50

  github.com/pingcap/failpoint.(*Failpoint).Enable()

      external/com_github_pingcap_failpoint/failpoint.go:54 +0x44

  github.com/pingcap/failpoint.(*Failpoints).Enable()

      external/com_github_pingcap_failpoint/failpoints.go:105 +0x276

  github.com/pingcap/failpoint.Enable()

      external/com_github_pingcap_failpoint/failpoints.go:222 +0x1eb

  github.com/pingcap/tidb/server.TestTopSQLCPUProfile()

      server/tidb_test.go:1370 +0x1ec

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

      domain/domain.go:1449 +0xb9

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

      session/session.go:3355 +0x7cc

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

      domain/sysvar_cache.go:62 +0x71

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

      session/session.go:3688 +0x11e

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

      session/session.go:2153 +0x16b

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

      session/session.go:1683 +0x365

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

      domain/domain.go:1393 +0x143

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

      session/session.go:3348 +0x76c

  github.com/pingcap/tidb/server.createTidbTestSuiteWithCfg()

      server/tidb_test.go:102 +0x219

  github.com/pingcap/tidb/server.createTidbTestSuite()

      server/tidb_test.go:91 +0xc5

  github.com/pingcap/tidb/server.createTidbTestTopSQLSuite()

      server/tidb_test.go:140 +0x53

  github.com/pingcap/tidb/server.TestTopSQLCPUProfile()

      server/tidb_test.go:1362 +0x4a

  testing.tRunner()

      GOROOT/src/testing/testing.go:1576 +0x216

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

      GOROOT/src/testing/testing.go:1629 +0x47


Goroutine 79206 (running) created at:

  github.com/pingcap/tidb/store/copr.(*copIterator).open()

      store/copr/coprocessor.go:833 +0x11d

  github.com/pingcap/tidb/store/copr.(*CopClient).Send()

      store/copr/coprocessor.go:105 +0x36e

  github.com/pingcap/tidb/distsql.Select()

      distsql/distsql.go:99 +0x88d

  github.com/pingcap/tidb/distsql.SelectWithRuntimeStats()

      distsql/distsql.go:140 +0xcc

  github.com/pingcap/tidb/executor.selectResultHook.SelectResult()

      executor/table_reader.go:58 +0x204

  github.com/pingcap/tidb/executor.(*TableReaderExecutor).buildResp()

      executor/table_reader.go:323 +0x7eb

  github.com/pingcap/tidb/executor.(*TableReaderExecutor).Open()

      executor/table_reader.go:220 +0x12b3

  github.com/pingcap/tidb/executor.(*baseExecutor).Open()

      executor/executor.go:202 +0xf5

  github.com/pingcap/tidb/executor.(*HashJoinExec).Open()

      executor/join.go:196 +0x7a

  github.com/pingcap/tidb/executor.(*ExecStmt).openExecutor()

      executor/adapter.go:1228 +0x109

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

      executor/adapter.go:550 +0xbd4

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

      session/session.go:2377 +0x701

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

      session/session.go:2234 +0x1024

  github.com/pingcap/tidb/server.(*TiDBContext).ExecuteStmt()

      server/driver_tidb.go:247 +0x12d

  github.com/pingcap/tidb/server.(*clientConn).handleStmt()

      server/conn.go:2045 +0x1e4

  github.com/pingcap/tidb/server.(*clientConn).handleQuery()

      server/conn.go:1895 +0xc9a

  github.com/pingcap/tidb/server.(*clientConn).dispatch()

      server/conn.go:1384 +0x153a

  github.com/pingcap/tidb/server.(*clientConn).Run()

      server/conn.go:1144 +0x39a

  github.com/pingcap/tidb/server.(*Server).onConn()

      server/server.go:646 +0x1a04

  github.com/pingcap/tidb/server.(*Server).startNetworkListener.func1()

      server/server.go:481 +0x47


Goroutine 46613 (running) created at:

  testing.(*T).Run()

      GOROOT/src/testing/testing.go:1629 +0x805

  testing.runTests.func1()

      GOROOT/src/testing/testing.go:2036 +0x8d

  testing.tRunner()

      GOROOT/src/testing/testing.go:1576 +0x216

  testing.runTests()

      GOROOT/src/testing/testing.go:2034 +0x87c

  testing.(*M).Run()

      GOROOT/src/testing/testing.go:1906 +0xb44

  go.uber.org/goleak.VerifyTestMain()

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

  github.com/pingcap/tidb/server.TestMain()

      server/main_test.go:74 +0xe59

  main.main()

      bazel-out/k8-fastbuild/bin/server/server_test_/testmain.go:426 +0x7ce

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

4. What is your TiDB version? (Required)

@hawkingrei hawkingrei added type/bug The issue is confirmed as a bug. component/test labels Mar 2, 2023
@hawkingrei
Copy link
Member Author

It will cause a flaky test.

@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 labels Mar 2, 2023
@ChenPeng2013 ChenPeng2013 removed may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-6.1 labels Mar 2, 2023
@jebter jebter added the component/ddl This issue is related to DDL of TiDB. label Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants