Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

receive: fix limits reloading race #6826

Merged
merged 1 commit into from
Oct 20, 2023
Merged

receive: fix limits reloading race #6826

merged 1 commit into from
Oct 20, 2023

Commits on Oct 19, 2023

  1. receive: fix limits reloading race

    We are re-reading the limits configuration periodically and also reading
    it at the same time hence we need a lock around it. Thus, let's make
    that struct member private and add a getter that returns the limiter
    under a mutex lock.
    
    Fixes:
    
    ```
    17:14:45 receive-i3: WARNING: DATA RACE
    17:14:45 receive-i3: Read at 0x00c00090aec0 by goroutine 131:
    17:14:45 receive-i3: github.com/thanos-io/thanos/pkg/receive.(*headSeriesLimit).QueryMetaMonitoring()
    17:14:45 receive-i3: /go/src/github.com/thanos-io/thanos/pkg/receive/head_series_limiter.go:109 +0x2fb
    17:14:45 receive-i3: main.runReceive.func9.1()
    17:14:45 receive-i3: /go/src/github.com/thanos-io/thanos/cmd/thanos/receive.go:402 +0x9b
    17:14:45 receive-i3: github.com/thanos-io/thanos/pkg/runutil.Repeat()
    17:14:45 receive-i3: /go/src/github.com/thanos-io/thanos/pkg/runutil/runutil.go:74 +0xc3
    17:14:45 receive-i3: Previous write at 0x00c00090aec0 by goroutine 138:
    17:14:45 receive-i3: github.com/thanos-io/thanos/pkg/receive.NewHeadSeriesLimit()
    17:14:45 receive-i3: /go/src/github.com/thanos-io/thanos/pkg/receive/head_series_limiter.go:41 +0x316
    17:14:45 receive-i3: github.com/thanos-io/thanos/pkg/receive.(*Limiter).loadConfig()
    17:14:45 receive-i3: /go/src/github.com/thanos-io/thanos/pkg/receive/limiter.go:168 +0xd0d
    17:14:45 receive-i3: github.com/thanos-io/thanos/pkg/receive.(*Limiter).StartConfigReloader.func1()
    17:14:45 receive-i3: /go/src/github.com/thanos-io/thanos/pkg/receive/limiter.go:111 +0x207
    17:14:45 receive-i3: github.com/thanos-io/thanos/pkg/extkingpin.(*pollingEngine).start.func1()
    ```
    
    Signed-off-by: Giedrius Statkevičius <[email protected]>
    GiedriusS committed Oct 19, 2023
    Configuration menu
    Copy the full SHA
    278fab0 View commit details
    Browse the repository at this point in the history