Skip to content

Commit

Permalink
bugfix: Stop the current fetcher before replacing it (#9582) (#9583)
Browse files Browse the repository at this point in the history
Otherwise, this causes a memory leak as we leave lingering around the resources we used to catch up as quickly as possible as the ingester was starting.

part of grafana/mimir-squad#2475

Signed-off-by: gotjosh <[email protected]>
(cherry picked from commit 0c60705)

Co-authored-by: gotjosh <[email protected]>
  • Loading branch information
grafanabot and gotjosh authored Oct 10, 2024
1 parent 245ed65 commit 57a179f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/storage/ingest/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@ func (r *PartitionReader) switchToOngoingFetcher(ctx context.Context) {
}

if r.kafkaCfg.StartupFetchConcurrency > 0 && r.kafkaCfg.OngoingFetchConcurrency == 0 {
// Stop the current fetcher before replacing it.
r.fetcher.Stop()

if r.fetcher == r {
// This method has been called before, no need to switch the fetcher.
return
Expand Down

0 comments on commit 57a179f

Please sign in to comment.