influxdata / influxdata/influxdb
Data race in `TestStore_CreateShard/tsi1`
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
See for example: https://app.circleci.com/pipelines/github/influxdata/influxdb/20846/workflows/1dbb815e-f78c-496f-ae8b-4cc5bd7be179/jobs/192711
The full race output was:
```
WARNING: DATA RACE
Read at 0x00c000892043 by goroutine 30:
testing.(*common).logDepth()
/usr/local/go/src/testing/testing.go:759 +0x164
testing.(*common).log()
/usr/local/go/src/testing/testing.go:746 +0x8f
testing.(*common).Logf()
/usr/local/go/src/testing/testing.go:792 +0x21
testing.(*T).Logf()
:1 +0x75
go.uber.org/zap/zaptest.testingWriter.Write()
/home/circleci/go/pkg/mod/go.uber.org/zap@v1.14.1/zaptest/logger.go:130 +0x153
go.uber.org/zap/zaptest.(*testingWriter).Write()
:1 +0xad
go.uber.org/zap/zapcore.(*ioCore).Write()
/home/circleci/go/pkg/mod/go.uber.org/zap@v1.14.1/zapcore/core.go:90 +0x1e7
go.uber.org/zap/zapcore.(*CheckedEntry).Write()
/home/circleci/go/pkg/mod/go.uber.org/zap@v1.14.1/zapcore/entry.go:216 +0x1f1
go.uber.org/zap.(*Logger).Info()
/home/circleci/go/pkg/mod/go.uber.org/zap@v1.14.1/logger.go:187 +0x9a
github.com/influxdata/influxdb/v2/tsdb.(*Store).loadShards.func1()
/home/circleci/go/src/github.com/influxdata/influxdb/tsdb/store.go:399 +0x15f2
Previous write at 0x00c000892043 by goroutine 8:
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:1180 +0x52c
testing.tRunner()
/usr/local/go/src/testing/testing.go:1197 +0x22a
Goroutine 30 (running) created at:
github.com/influxdata/influxdb/v2/tsdb.(*Store).loadShards()
/home/circleci/go/src/github.com/influxdata/influxdb/tsdb/store.go:355 +0x256a
github.com/influxdata/influxdb/v2/tsdb.(*Store).Open()
/home/circleci/go/src/github.com/influxdata/influxdb/tsdb/store.go:220 +0x384
github.com/influxdata/influxdb/v2/tsdb_test.(*Store).Reopen()
/home/circleci/go/src/github.com/influxdata/influxdb/tsdb/store_test.go:2367 +0x3b8
github.com/influxdata/influxdb/v2/tsdb_test.TestStore_DeleteRetentionPolicy.func1()
/home/circleci/go/src/github.com/influxdata/influxdb/tsdb/store_test.go:90 +0x724
github.com/influxdata/influxdb/v2/tsdb_test.TestStore_DeleteRetentionPolicy.func2()
/home/circleci/go/src/github.com/influxdata/influxdb/tsdb/store_test.go:106 +0x78
testing.tRunner()
/usr/local/go/src/testing/testing.go:1193 +0x202
Goroutine 8 (finished) created at:
testing.(*T).Run()
/usr/local/go/src/testing/testing.go:1238 +0x5d7
testing.runTests.func1()
/usr/local/go/src/testing/testing.go:1511 +0xa6
testing.tRunner()
/usr/local/go/src/testing/testing.go:1193 +0x202
testing.runTests()
/usr/local/go/src/testing/testing.go:1509 +0x612
testing.(*M).Run()
/usr/local/go/src/testing/testing.go:1417 +0x3b3
main.main()
_testmain.go:373 +0x236
```
Contributor guide
Research direction
Start with tsdb/store.go at Store.loadShards and tsdb/store_test.go around TestStore_CreateShard/tsi1 and the Reopen helper. Run the named test with the race detector and compare the output with the reported testing.(*common).logDepth race; done means the test completes without this race warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- databases, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100