Skip to content

Conversation

@na--
Copy link
Contributor

@na-- na-- commented Dec 18, 2024

What this PR does / why we need it:

Without these changes, the tests fail when executed with -race:

WARNING: DATA RACE
Write at 0x00c0126fd5b0 by goroutine 47612:
  github.com/grafana/loki/v3/pkg/ingester.(*readRingMock).GetAllHealthy()
      github.com/grafana/loki/v3/pkg/ingester/ingester_test.go:1541 +0x6e
  github.com/grafana/loki/v3/pkg/ingester.(*ownedStreamsIngesterStrategy).checkRingForChanges()
      github.com/grafana/loki/v3/pkg/ingester/recalculate_owned_streams.go:117 +0x77
  github.com/grafana/loki/v3/pkg/ingester.(*recalculateOwnedStreamsSvc).recalculate()
      github.com/grafana/loki/v3/pkg/ingester/recalculate_owned_streams.go:54 +0x2af
  github.com/grafana/loki/v3/pkg/ingester.(*recalculateOwnedStreamsSvc).iteration()
      github.com/grafana/loki/v3/pkg/ingester/recalculate_owned_streams.go:44 +0x33
  github.com/grafana/loki/v3/pkg/ingester.(*recalculateOwnedStreamsSvc).iteration-fm()
      <autogenerated>:1 +0x17
  github.com/grafana/loki/v3/pkg/ingester.Test_recalculateOwnedStreams_newRecalculateOwnedStreamsIngester.newRecalculateOwnedStreamsSvc.NewTimerService.func5()
      github.com/grafana/dskit@v0.0.0-20241007172036-53283a0f6b41/services/services.go:33 +0x1d8
  github.com/grafana/dskit/services.(*BasicService).main()
      github.com/grafana/dskit@v0.0.0-20241007172036-53283a0f6b41/services/basic_service.go:193 +0x3b7
  github.com/grafana/dskit/services.(*BasicService).StartAsync.func1.gowrap1()
      github.com/grafana/dskit@v0.0.0-20241007172036-53283a0f6b41/services/basic_service.go:122 +0x33

Previous read at 0x00c0126fd5b0 by goroutine 47613:
  github.com/grafana/loki/v3/pkg/ingester.Test_recalculateOwnedStreams_newRecalculateOwnedStreamsIngester.func1()
      github.com/grafana/loki/v3/pkg/ingester/recalculate_owned_streams_test.go:33 +0x37
  github.com/stretchr/testify/assert.Eventually.func1()
      github.com/stretchr/testify@v1.10.0/assert/assertions.go:1949 +0x33
...
@na-- na-- requested a review from a team as a code owner December 18, 2024 11:34
Copy link
Contributor

@salvacorts salvacorts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 Thank you!

@na-- na-- merged commit 04f621e into main Dec 18, 2024
60 checks passed
@na-- na-- deleted the ned/fix-data-race-04 branch December 18, 2024 12:43
mveitas pushed a commit to mveitas/loki that referenced this pull request Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 participants