Skip to content

DATA RACE in the TestReleaseWhenRunningPool #42130

@hawkingrei

Description

@hawkingrei

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 0x00c000261228 by goroutine 20:
  runtime.racewrite()
      <autogenerated>:1 +0x24
  github.com/pingcap/tidb/resourcemanager/pool/spool.(*Pool).ReleaseAndWait()
      resourcemanager/pool/spool/spool.go:176 +0x48
  github.com/pingcap/tidb/resourcemanager/pool/spool.TestReleaseWhenRunningPool()
      resourcemanager/pool/spool/spool_test.go:64 +0x224
  testing.tRunner()
      GOROOT/src/testing/testing.go:1576 +0x216
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1629 +0x47
Previous read at 0x00c000261228 by goroutine 21:
  runtime.raceread()
      <autogenerated>:1 +0x24
  github.com/pingcap/tidb/resourcemanager/pool/spool.(*Pool).run()
      resourcemanager/pool/spool/spool.go:109 +0x3c
  github.com/pingcap/tidb/resourcemanager/pool/spool.(*Pool).Run()
      resourcemanager/pool/spool/spool.go:90 +0xa6
  github.com/pingcap/tidb/resourcemanager/pool/spool.TestReleaseWhenRunningPool.func1()
      resourcemanager/pool/spool/spool_test.go:50 +0xaf
Goroutine 20 (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/resourcemanager/pool/spool.TestMain()
      resourcemanager/pool/spool/main_test.go:32 +0x435
  main.main()
      bazel-out/k8-fastbuild/bin/resourcemanager/pool/spool/spool_test_/testmain.go:110 +0x5e8
Goroutine 21 (running) created at:
  github.com/pingcap/tidb/resourcemanager/pool/spool.TestReleaseWhenRunningPool()
      resourcemanager/pool/spool/spool_test.go:47 +0x164
  testing.tRunner()
      GOROOT/src/testing/testing.go:1576 +0x216
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1629 +0x47
==================
--- FAIL: TestReleaseWhenRunningPool (0.01s)
    testing.go:1446: race detected during execution of test
panic: sync: WaitGroup is reused before previous Wait has returned [recovered]
	panic: sync: WaitGroup is reused before previous Wait has returned
goroutine 35 [running]:
testing.tRunner.func1.2({0x18fe2e0, 0x1f6da60})
	GOROOT/src/testing/testing.go:1526 +0x372
testing.tRunner.func1()
	GOROOT/src/testing/testing.go:1529 +0x650
panic({0x18fe2e0, 0x1f6da60})
	GOROOT/src/runtime/panic.go:890 +0x263
sync.(*WaitGroup).Wait(0xc000261220)
	GOROOT/src/sync/waitgroup.go:118 +0x107
github.com/pingcap/tidb/resourcemanager/pool/spool.(*Pool).ReleaseAndWait(0xc000261220)
	resourcemanager/pool/spool/spool.go:176 +0x49
github.com/pingcap/tidb/resourcemanager/pool/spool.TestReleaseWhenRunningPool(0x0?)
	resourcemanager/pool/spool/spool_test.go:64 +0x225
testing.tRunner(0xc000307ba0, 0x1b7ec50)
	GOROOT/src/testing/testing.go:1576 +0x217
created by testing.(*T).Run
	GOROOT/src/testing/testing.go:1629 +0x806 

4. What is your TiDB version? (Required)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions