prebid / prebid-server

Open-source solution for running real-time advertising auctions in the cloud.
https://prebid.org/product-suite/prebid-server/
Apache License 2.0
404 stars 703 forks source link

`go test -race ./...` fails with races detected #3482

Open dmitris opened 4 months ago

dmitris commented 4 months ago

go test -race ./... run in the repo root fails with races detected - https://gist.github.com/dmitris/d816f41bb12bd99d485e917d8728c320 Do you know any background or history on that? Is it expected? We stumbled on this trying to build the repo in our CI which has the testrace step.

partial excerpt:

==================
WARNING: DATA RACE
Read at 0x00c00057a510 by goroutine 152:
  github.com/prebid/prebid-server/v2/floors.TestFetcherWhenRequestGetSameURLInrequest.func2()
      /Users/dmitris/gh/prebid/prebid-server/floors/fetcher_test.go:837 +0x34
  github.com/stretchr/testify/assert.Never.func1()
      /Users/dmitris/go/pkg/mod/github.com/stretchr/testify@v1.8.1/assert/assertions.go:1782 +0x38

Previous write at 0x00c00057a510 by goroutine 143:
  github.com/prebid/prebid-server/v2/floors.(*FetchQueue).Push()
      /Users/dmitris/gh/prebid/prebid-server/floors/fetcher.go:72 +0xe8
  container/heap.Push()
      /usr/local/go/src/container/heap/heap.go:52 +0x48
  github.com/prebid/prebid-server/v2/floors.(*PriceFloorFetcher).Fetcher()
      /Users/dmitris/gh/prebid/prebid-server/floors/fetcher.go:212 +0x280
  github.com/prebid/prebid-server/v2/floors.mockFetcherInstance.gowrap1()
      /Users/dmitris/gh/prebid/prebid-server/floors/fetcher_test.go:790 +0x34

Goroutine 152 (running) created at:
  github.com/stretchr/testify/assert.Never()
      /Users/dmitris/go/pkg/mod/github.com/stretchr/testify@v1.8.1/assert/assertions.go:1782 +0x2cc
  github.com/prebid/prebid-server/v2/floors.TestFetcherWhenRequestGetSameURLInrequest()
      /Users/dmitris/gh/prebid/prebid-server/floors/fetcher_test.go:837 +0x3fc
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1689 +0x180
  testing.(*T).Run.gowrap1()
      /usr/local/go/src/testing/testing.go:1742 +0x40

Goroutine 143 (running) created at:
  github.com/prebid/prebid-server/v2/floors.mockFetcherInstance()
      /Users/dmitris/gh/prebid/prebid-server/floors/fetcher_test.go:790 +0x284
  github.com/prebid/prebid-server/v2/floors.TestFetcherWhenRequestGetSameURLInrequest()
      /Users/dmitris/gh/prebid/prebid-server/floors/fetcher_test.go:816 +0x228
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1689 +0x180
  testing.(*T).Run.gowrap1()
      /usr/local/go/src/testing/testing.go:1742 +0x40
==================
SyntaxNode commented 4 months ago

It's not expected. Looks like this was recently introduced in tests for the Floors feature. Is this the only data race found?