Racy Test: TestGarbageCollectLogStatistics
Seeing a racy test failure in https://gitlab.com/gitlab-org/gitaly/-/jobs/1801447510
=== RUN TestGarbageCollectSuccess/without_bitmap
==================
WARNING: DATA RACE
Write at 0x00c004600a80 by goroutine 242:
bytes.(*Buffer).tryGrowByReslice()
/usr/local/go/src/bytes/buffer.go:108 +0xb3
bytes.(*Buffer).Write()
/usr/local/go/src/bytes/buffer.go:170 +0x18
github.com/sirupsen/logrus.(*Entry).write()
/root/go/pkg/mod/github.com/sirupsen/logrus@v1.8.1/entry.go:286 +0x258
github.com/sirupsen/logrus.(*Entry).log()
/root/go/pkg/mod/github.com/sirupsen/logrus@v1.8.1/entry.go:251 +0x453
github.com/sirupsen/logrus.(*Entry).Log()
/root/go/pkg/mod/github.com/sirupsen/logrus@v1.8.1/entry.go:293 +0x8b
github.com/sirupsen/logrus.(*Entry).Logf()
/root/go/pkg/mod/github.com/sirupsen/logrus@v1.8.1/entry.go:338 +0xc4
github.com/sirupsen/logrus.(*Entry).Infof()
/root/go/pkg/mod/github.com/sirupsen/logrus@v1.8.1/entry.go:351 +0x1d2
github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus.DefaultMessageProducer()
/root/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/logging/logrus/options.go:220 +0x1d3
gitlab.com/gitlab-org/gitaly/v14/internal/log.PerRPCLogHandler.HandleRPC()
/builds/gitlab-org/gitaly/internal/log/log.go:231 +0x4ae
gitlab.com/gitlab-org/gitaly/v14/internal/log.(*PerRPCLogHandler).HandleRPC()
<autogenerated>:1 +0xd6
google.golang.org/grpc.(*Server).processUnaryRPC.func1()
/root/go/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:1175 +0x617
google.golang.org/grpc.(*Server).processUnaryRPC()
/root/go/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:1375 +0x199f
google.golang.org/grpc.(*Server).handleStream()
/root/go/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:1609 +0xfd3
google.golang.org/grpc.(*Server).serveStreams.func1.2()
/root/go/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:934 +0xfd
Previous read at 0x00c004600a80 by goroutine 148:
bytes.(*Buffer).String()
/usr/local/go/src/bytes/buffer.go:65 +0x414
gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/repository.TestGarbageCollectLogStatistics()
/builds/gitlab-org/gitaly/internal/gitaly/service/repository/gc_test.go:152 +0x3f1
testing.tRunner()
/usr/local/go/src/testing/testing.go:1259 +0x22f
testing.(*T).Run·dwrap·21()
/usr/local/go/src/testing/testing.go:1306 +0x47
Goroutine 242 (running) created at:
google.golang.org/grpc.(*Server).serveStreams.func1()
/root/go/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:932 +0x4d0
google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders()
/root/go/pkg/mod/google.golang.org/grpc@v1.38.0/internal/transport/http2_server.go:462 +0x27de
google.golang.org/grpc/internal/transport.(*http2Server).HandleStreams()
/root/go/pkg/mod/google.golang.org/grpc@v1.38.0/internal/transport/http2_server.go:507 +0x2fd
google.golang.org/grpc.(*Server).serveStreams()
/root/go/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:918 +0x289
google.golang.org/grpc.(*Server).handleRawConn.func1()
/root/go/pkg/mod/google.golang.org/grpc@v1.38.0/server.go:868 +0x64
Goroutine 148 (running) created at:
testing.(*T).Run()
/usr/local/go/src/testing/testing.go:1306 +0x726
testing.runTests.func1()
/usr/local/go/src/testing/testing.go:1598 +0x99
testing.tRunner()
/usr/local/go/src/testing/testing.go:1259 +0x22f
testing.runTests()
/usr/local/go/src/testing/testing.go:1596 +0x7ca
testing.(*M).Run()
/usr/local/go/src/testing/testing.go:1504 +0x9d1
gitlab.com/gitlab-org/gitaly/v14/internal/testhelper.Run.func1()
/builds/gitlab-org/gitaly/internal/testhelper/configure.go:73 +0x376
gitlab.com/gitlab-org/gitaly/v14/internal/testhelper.Run()
/builds/gitlab-org/gitaly/internal/testhelper/configure.go:76 +0x5a
gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/repository.TestMain()
/builds/gitlab-org/gitaly/internal/gitaly/service/repository/testhelper_test.go:38 +0x268
main.main()
_testmain.go:337 +0x25c
==================
Edited by John Cai