prebid-server icon indicating copy to clipboard operation
prebid-server copied to clipboard

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

Open dmitris opened this issue 1 year ago • 2 comments

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/[email protected]/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/[email protected]/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
==================

dmitris avatar Feb 09 '24 17:02 dmitris

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

SyntaxNode avatar Feb 13 '24 16:02 SyntaxNode