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 BasicRuntimeStats #42337

Closed
hawkingrei opened this issue Mar 16, 2023 · 1 comment · Fixed by #42338
Closed

DATA RACE in the BasicRuntimeStats #42337

hawkingrei opened this issue Mar 16, 2023 · 1 comment · Fixed by #42338
Labels
affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.5 This bug affects the 6.5.x(LTS) versions. component/test report/customer Customers have encountered this bug. severity/moderate sig/sql-infra SIG: SQL Infra 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 0x00c019a0f6e0 by goroutine 68486:
  sync/atomic.AddInt32()
      src/runtime/race_amd64.s:281 +0xb
  sync/atomic.AddInt32()
      <autogenerated>:1 +0x1a
  github.com/pingcap/tidb/executor.(*LoadDataWorker).CheckAndInsertOneBatch.func1()
      executor/load_data.go:821 +0xb8
  runtime.deferreturn()
      GOROOT/src/runtime/panic.go:476 +0x32
  github.com/pingcap/tidb/executor.(*LoadDataWorker).commitOneTask()
      executor/load_data.go:794 +0x15b
  github.com/pingcap/tidb/executor.(*LoadDataWorker).commitWork()
      executor/load_data.go:755 +0x384
  github.com/pingcap/tidb/executor.(*LoadDataWorker).doLoad.func4()
      executor/load_data.go:545 +0xc6
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      external/org_golang_x_sync/errgroup/errgroup.go:75 +0x82
Previous read at 0x00c019a0f6e0 by goroutine 60815:
  github.com/pingcap/tidb/util/execdetails.(*BasicRuntimeStats).Clone()
      util/execdetails/execdetails.go:604 +0x379
  github.com/pingcap/tidb/executor.(*InsertRuntimeStat).Clone()
      executor/insert_common.go:1455 +0x217
  github.com/pingcap/tidb/util/execdetails.(*RuntimeStatsColl).RegisterStats()
      util/execdetails/execdetails.go:745 +0x2bb
  github.com/pingcap/tidb/executor.(*LoadDataExec).Close.func1()
      executor/load_data.go:221 +0x64
  runtime.deferreturn()
      GOROOT/src/runtime/panic.go:476 +0x32
  github.com/pingcap/tidb/executor.(*recordSet).Close()
      executor/adapter.go:179 +0x4c
  github.com/pingcap/tidb/session.(*execStmtResult).Close()
      session/session.go:2388 +0x6f
  github.com/pingcap/tidb/session.ResultSetToStringSlice()
      session/tidb.go:372 +0xeb
  github.com/pingcap/tidb/testkit.(*TestKit).ResultSetToResultWithCtx()
      testkit/testkit.go:223 +0xbc
  github.com/pingcap/tidb/testkit.(*TestKit).MustQueryWithContext()
      testkit/testkit.go:158 +0x284
  github.com/pingcap/tidb/testkit.(*TestKit).MustQuery()
      testkit/testkit.go:149 +0x107
  github.com/pingcap/tidb/executor/asyncloaddata_test.(*mockGCSSuite).TestSameBehaviourDetachedOrNot()
      executor/asyncloaddata/detach_test.go:75 +0x764
  runtime.call16()
      src/runtime/asm_amd64.s:728 +0x48
  reflect.Value.Call()
      GOROOT/src/reflect/value.go:370 +0xc7
  github.com/stretchr/testify/suite.Run.func1()
      external/com_github_stretchr_testify/suite/suite.go:197 +0x70d
  testing.tRunner()
      GOROOT/src/testing/testing.go:1576 +0x216
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1629 +0x47
Goroutine 68486 (running) created at:
  golang.org/x/sync/errgroup.(*Group).Go()
      external/org_golang_x_sync/errgroup/errgroup.go:72 +0x12e
  github.com/pingcap/tidb/executor.(*LoadDataWorker).doLoad()
      executor/load_data.go:543 +0xa44
  github.com/pingcap/tidb/executor.(*LoadDataWorker).Load.func1()
      executor/load_data.go:426 +0xbe
Goroutine 60815 (running) created at:
  testing.(*T).Run()
      GOROOT/src/testing/testing.go:1629 +0x805
  github.com/stretchr/testify/suite.runTests()
      external/com_github_stretchr_testify/suite/suite.go:242 +0x19c
  github.com/stretchr/testify/suite.Run()
      external/com_github_stretchr_testify/suite/suite.go:215 +0x9b2
  github.com/pingcap/tidb/session.BootstrapSession()
      session/session.go:3314 +0x6d3
  github.com/pingcap/tidb/domain.(*Domain).GetSessionCache()
      domain/sysvar_cache.go:62 +0x5c
  github.com/pingcap/tidb/session.(*session).loadCommonGlobalVariablesIfNeeded()
      session/session.go:3656 +0x104
  github.com/pingcap/tidb/session.(*session).ExecuteStmt()
      session/session.go:2093 +0x145
  github.com/pingcap/tidb/session.(*session).ExecuteInternal()
      session/session.go:1628 +0x31b
  github.com/pingcap/tidb/domain.(*Domain).LoadPrivilegeLoop()
      domain/domain.go:1414 +0x130
  github.com/pingcap/tidb/session.BootstrapSession()
      session/session.go:3307 +0x684
  github.com/pingcap/tidb/testkit.bootstrap()
      testkit/mockstore.go:85 +0xac
  github.com/pingcap/tidb/testkit.CreateMockStoreAndDomain()
      testkit/mockstore.go:70 +0xe9
  github.com/pingcap/tidb/testkit.CreateMockStore()
      testkit/mockstore.go:62 +0x3b1
  github.com/pingcap/tidb/executor/asyncloaddata_test.(*mockGCSSuite).SetupSuite()
      executor/asyncloaddata/show_test.go:68 +0x1d0
  github.com/stretchr/testify/suite.Run()
      external/com_github_stretchr_testify/suite/suite.go:154 +0x5d7
  github.com/pingcap/tidb/executor/asyncloaddata_test.TestAsyncLoad()
      executor/asyncloaddata/show_test.go:55 +0x9b
  testing.tRunner()
      GOROOT/src/testing/testing.go:1576 +0x216
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1629 +0x47
================== 

4. What is your TiDB version? (Required)

@hawkingrei hawkingrei added the type/bug The issue is confirmed as a bug. label Mar 16, 2023
@ti-chi-bot ti-chi-bot added affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.5 This bug affects the 6.5.x(LTS) versions. labels Dec 20, 2023
@Ivy-YinSu Ivy-YinSu added the sig/sql-infra SIG: SQL Infra label Dec 22, 2023
@seiya-annie
Copy link

/found customer

@ti-chi-bot ti-chi-bot bot added the report/customer Customers have encountered this bug. label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.5 This bug affects the 6.5.x(LTS) versions. component/test report/customer Customers have encountered this bug. severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants