fix: leaking cluster clients in EmbeddedDMap.Scan#270
Merged
buraksezer merged 2 commits intoOct 28, 2025
Conversation
Fix for olric-data#263 Problem: `EmbeddedDMap.Scan` function creates cluster client which stays alive with `fetchRoutingTablePeriodically` in a separate go-routine created in `NewClusterClient`. This causes memory leaks similar to olric-data#209. Solution: * make `ClusterClient.fetchRoutingTable` interruptable by using cluster client's `ctx` inside; * make `DMap` `Close`-able and call `ClusterClient.Close` for cluster client cached by `EmbeddedDMap`.
3d8eb7b to
1ad980c
Compare
|
It'd be nice to get this merged |
Collaborator
Hey @marclop, just a heads up — the PR has been merged and is part of the Olric 0.7.1 release. Thanks for the patience! 🙌 I released the new version recently. |
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.
Fix for #263
Problem:
EmbeddedDMap.Scanfunction creates cluster client which stays alive withfetchRoutingTablePeriodicallyin a separate go-routine created inNewClusterClient. This causes memory leaks similar to #209.Solution:
ClusterClient.fetchRoutingTableinterruptable by using cluster client'sctxinside;DMapClose-able and callClusterClient.Closefor cluster client cached byEmbeddedDMap.NOTE: I couldn't come up with a more clean test and resorted to outputting stacks and mem stats as in the original problem description. Maybe we could check that there are no more than 2 go-routines left?