Repository navigation
Conversation
ThanosBucketStores.Stop() did not stop the concurrent data bytes tracker, so the goroutine publishing the peak bytes metric was never stopped. The tracker also leaked when newThanosBucketStores() failed after creating it, and the store-gateway left the bucket stores running when starting failed, because the stopping function is not called after a failed start. Stop the tracker in ThanosBucketStores.Stop() and when the bucket stores can't be created, stop the bucket stores when starting fails, and stop trackers and bucket stores in tests. This removes about 1700 goroutines leaked by the store-gateway tests. Ref cortexproject#3962 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YDgKpXdZmLs9YSYU1ZSf8d Signed-off-by: Andrey Osipov <blaketsk@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YDgKpXdZmLs9YSYU1ZSf8d Signed-off-by: Andrey Osipov <blaketsk@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does:
Stops the store-gateway concurrent data bytes tracker, whose goroutine publishing
cortex_storegateway_concurrent_data_bytes_peakwas never stopped:ThanosBucketStores.Stop()returnednilwithout stopping the tracker. It now stops it.newThanosBucketStores()leaked the tracker when it failed after creating it (users scanner, matchers cache, index cache or chunks pool setup). The tracker is now stopped on these error paths.StoreGateway.starting()left the bucket stores running when it failed, becauseBasicServicedoes not call the stopping function after a failed start. The bucket stores are now stopped together with the subservices in the existing error handler.Running the
pkg/storegatewaytests withgoleak.VerifyTestMainreported 1696 leaked goroutines before this change (1688 of thempublishPeakLoop) and 28 after. The remaining ones are unrelated (parquet shard cache, Thanos index header reader pool and third-partyinitgoroutines) and are left for follow-ups.TestBucketStores_StopShouldStopConcurrentDataBytesTrackerand the new assertion inTestStoreGateway_InitialSyncFailurefail without the fix.Which issue(s) this PR fixes:
Part of #3962
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]docs/configuration/v1-guarantees.mdupdated if this PR introduces experimental flagsAI disclosure: per GENAI_POLICY.md, the leak survey, the fix and the tests were prepared with Claude Code. I reviewed and verified the changes.
🤖 Generated with Claude Code