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

Test case bindinfo.TestCaptureUserFilter data race #39453

Closed
tiancaiamao opened this issue Nov 29, 2022 · 0 comments · Fixed by #39721
Closed

Test case bindinfo.TestCaptureUserFilter data race #39453

tiancaiamao opened this issue Nov 29, 2022 · 0 comments · Fixed by #39721
Assignees
Labels

Comments

@tiancaiamao
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Found in CI

https://do.pingcap.net/jenkins/blue/organizations/jenkins/pingcap%2Ftidb%2Fghpr_unit_test/detail/ghpr_unit_test/7755/tests

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

No data race

3. What did you see instead (Required)

==================
WARNING: DATA RACE
Write at 0x00c005616210 by goroutine 114:
  runtime.mapassign_faststr()
      GOROOT/src/runtime/map_faststr.go:203 +0x0
  github.com/pingcap/tidb/util/stmtsummary.(*stmtSummaryByDigestElement).add()
      util/stmtsummary/statement_summary.go:665 +0x166
  github.com/pingcap/tidb/util/stmtsummary.(*stmtSummaryByDigest).add()
      util/stmtsummary/statement_summary.go:573 +0xb2
  github.com/pingcap/tidb/util/stmtsummary.(*stmtSummaryByDigestMap).AddStatement()
      util/stmtsummary/statement_summary.go:340 +0x590
  github.com/pingcap/tidb/executor.(*ExecStmt).SummaryStmt()
      executor/adapter.go:1795 +0x1bf1
  github.com/pingcap/tidb/executor.(*ExecStmt).FinishExecuteStmt()
      executor/adapter.go:1364 +0x7de
  github.com/pingcap/tidb/executor.(*ExecStmt).CloseRecordSet()
      executor/adapter.go:1394 +0x64
  github.com/pingcap/tidb/executor.(*recordSet).Close()
      executor/adapter.go:183 +0xcb
  github.com/pingcap/tidb/session.(*execStmtResult).Close()
      session/session.go:2381 +0x7e
  github.com/pingcap/tidb/testkit.(*TestKit).MustExecWithContext()
      testkit/testkit.go:132 +0x28f
  github.com/pingcap/tidb/testkit.(*TestKit).MustExec()
      testkit/testkit.go:122 +0xf7
  github.com/pingcap/tidb/bindinfo_test.TestCaptureUserFilter()
      bindinfo/capture_test.go:643 +0xb5a
  github.com/pingcap/tidb/session.runStmt()
      session/session.go:2326 +0x85c
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      session/session.go:2190 +0x1266
  github.com/pingcap/tidb/testkit.(*TestKit).ExecWithContext()
      testkit/testkit.go:295 +0x84e
  github.com/pingcap/tidb/testkit.(*TestKit).MustExecWithContext()
      testkit/testkit.go:127 +0xb7
  github.com/pingcap/tidb/testkit.(*TestKit).MustExec()
      testkit/testkit.go:122 +0xf7
  github.com/pingcap/tidb/bindinfo_test.TestCaptureUserFilter()
      bindinfo/capture_test.go:611 +0xd0
  github.com/pingcap/tidb/domain.(*Domain).rebuildSysVarCache()
      domain/sysvar_cache.go:146 +0x73c
  github.com/pingcap/tidb/domain.(*Domain).LoadSysVarCacheLoop()
      domain/domain.go:1359 +0xb9
  github.com/pingcap/tidb/session.BootstrapSession()
      session/session.go:2984 +0x78c
  github.com/pingcap/tidb/domain.(*Domain).GetSessionCache()
      domain/sysvar_cache.go:62 +0x6a
  github.com/pingcap/tidb/session.(*session).loadCommonGlobalVariablesIfNeeded()
      session/session.go:3233 +0x11e
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      session/session.go:2105 +0x2fb
  github.com/pingcap/tidb/session.(*session).ExecuteInternal()
      session/session.go:1668 +0x4eb
  github.com/pingcap/tidb/domain.(*Domain).LoadPrivilegeLoop()
      domain/domain.go:1301 +0x143
  github.com/pingcap/tidb/session.BootstrapSession()
      session/session.go:2977 +0x72c
  github.com/pingcap/tidb/testkit.bootstrap()
      testkit/mockstore.go:83 +0x7b
  github.com/pingcap/tidb/testkit.CreateMockStoreAndDomain()
      testkit/mockstore.go:69 +0xd0
  github.com/pingcap/tidb/bindinfo_test.TestCaptureUserFilter()
      bindinfo/capture_test.go:607 +0x58
  testing.tRunner()
      GOROOT/src/testing/testing.go:1446 +0x216
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1493 +0x47
Previous read at 0x00c005616210 by goroutine 14476:
  runtime.mapiternext()
      GOROOT/src/runtime/map.go:866 +0x0
  github.com/pingcap/tidb/bindinfo.(*BindHandle).CaptureBaselines()
      bindinfo/handle.go:876 +0xfd3
  github.com/pingcap/tidb/domain.(*Domain).globalBindHandleWorkerLoop.func1()
      domain/domain.go:1476 +0x519
Goroutine 114 (running) created at:
  testing.(*T).Run()
      GOROOT/src/testing/testing.go:1493 +0x75d
  testing.runTests.func1()
      GOROOT/src/testing/testing.go:1846 +0x99
  testing.tRunner()
      GOROOT/src/testing/testing.go:1446 +0x216
  testing.runTests()
      GOROOT/src/testing/testing.go:1844 +0x7ec
  testing.(*M).Run()
      GOROOT/src/testing/testing.go:1726 +0xa84
  go.uber.org/goleak.VerifyTestMain()
      external/org_uber_go_goleak/testmain.go:53 +0x70
  github.com/pingcap/tidb/bindinfo_test.TestMain()
      bindinfo/main_test.go:32 +0x43c
  main.main()
      bazel-out/k8-fastbuild/bin/bindinfo/bindinfo_test_/testmain.go:268 +0x7c9
Goroutine 14476 (running) created at:
  github.com/pingcap/tidb/domain.(*Domain).globalBindHandleWorkerLoop()
      domain/domain.go:1450 +0x10a
  github.com/pingcap/tidb/domain.(*Domain).LoadBindInfoLoop()
      domain/domain.go:1443 +0x1f5
  github.com/pingcap/tidb/session.BootstrapSession()
      session/session.go:2971 +0x688
  github.com/pingcap/tidb/testkit.bootstrap()
      testkit/mockstore.go:83 +0x7b
  github.com/pingcap/tidb/testkit.CreateMockStoreAndDomain()
      testkit/mockstore.go:69 +0xd0
  github.com/pingcap/tidb/bindinfo_test.TestCaptureUserFilter()
      bindinfo/capture_test.go:607 +0x58
  testing.tRunner()
      GOROOT/src/testing/testing.go:1446 +0x216
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1493 +0x47
==================

4. What is your TiDB version? (Required)

#39041

@tiancaiamao tiancaiamao added the type/bug The issue is confirmed as a bug. label Nov 29, 2022
@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.0 may-affects-6.1 may-affects-6.2 may-affects-6.3 may-affects-6.4 labels Nov 30, 2022
@hawkingrei hawkingrei 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.0 may-affects-6.1 may-affects-6.2 may-affects-6.3 may-affects-6.4 labels Dec 7, 2022
@jebter jebter added the sig/planner SIG: Planner label Aug 4, 2023
@qw4990 qw4990 assigned qw4990 and hawkingrei and unassigned qw4990 Aug 16, 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.

6 participants