Skip to content

Commit

Permalink
bugfix: Stop the current fetcher before replacing it (#9582)
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]>
  • Loading branch information
gotjosh authored Oct 10, 2024
1 parent ff5dc78 commit 0c60705
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 0c60705

Please sign in to comment.