Skip to content

store limit test has data race issue #6369

@binshi-bing

Description

@binshi-bing

Flaky Test

Which jobs are failing

CGO_ENABLED=1 go test -timeout=15m -tags deadlock -race -covermode=atomic -coverprofile=covprofile -coverpkg=./... github.com/tikv/pd/pkg/core/storelimit github.com/tikv/pd/pkg/mcs/tso/server github.com/tikv/pd/pkg/schedule/operator github.com/tikv/pd/pkg/storage/kv github.com/tikv/pd/pkg/utils/keyutil github.com/tikv/pd/server/api

==================
WARNING: DATA RACE
Write at 0x00c00001adc8 by goroutine 16:
github.com/tikv/pd/pkg/core/storelimit.TestFeedback.func1()
/home/runner/work/pd/pd/pkg/core/storelimit/limit_test.go:137 +0xa4

Previous read at 0x00c00001adc8 by goroutine 15:
github.com/tikv/pd/pkg/core/storelimit.TestFeedback()
/home/runner/work/pd/pd/pkg/core/storelimit/limit_test.go:188 +0xee4
testing.tRunner()
/opt/hostedtoolcache/go/1.20.1/x64/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/opt/hostedtoolcache/go/1.20.1/x64/src/testing/testing.go:1629 +0x47

Goroutine 16 (running) created at:
github.com/tikv/pd/pkg/core/storelimit.TestFeedback()
/home/runner/work/pd/pd/pkg/core/storelimit/limit_test.go:134 +0x525
testing.tRunner()
/opt/hostedtoolcache/go/1.20.1/x64/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/opt/hostedtoolcache/go/1.20.1/x64/src/testing/testing.go:1629 +0x47

Goroutine 15 (running) created at:
testing.(*T).Run()
/opt/hostedtoolcache/go/1.20.1/x64/src/testing/testing.go:1629 +0x805
testing.runTests.func1()
/opt/hostedtoolcache/go/1.20.1/x64/src/testing/testing.go:2036 +0x8d
testing.tRunner()
/opt/hostedtoolcache/go/1.20.1/x64/src/testing/testing.go:1576 +0x216
testing.runTests()
/opt/hostedtoolcache/go/1.20.1/x64/src/testing/testing.go:2034 +0x87c
testing.(*M).Run()
/opt/hostedtoolcache/go/1.20.1/x64/src/testing/testing.go:1906 +0xb44
main.main()
_testmain.go:84 +0x2fc

--- FAIL: TestFeedback (1.63s)
testing.go:1446: race detected during execution of test

CI link

https://github.com/tikv/pd/actions/runs/4779473234/jobs/8496585204?pr=6358

Reason for failure (if possible)

a variable, used for test only, is accessed by multiple goroutines and isn't protected.

Anything else

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/ciThe issue is related to CI.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions