-
Notifications
You must be signed in to change notification settings - Fork 867
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
Clean WeakConcurrentMap from background thread #6240
Conversation
can you share thoughts / theories on why this is not enough? thx |
This map keeps weak reference to keys and strong reference to values. Keys are collected automatically but values are cleared only when map is accessed. This does not guarantee that values are cleared in timely fashion or that they are cleared at all. Using a background thread allows for clearing values immediately after the key is collected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry about the long delay, it was not so scary after digging in a bit 👍
thx @laurit ❤️ |
@mateuszrzeszutek / @trask We do Observe this particular issue causing a huge memory leak in some of our microservices. I am glad this is caught and fixed, but will this fix be backported to earlier versions? I am not aware of the version support process for OTEL agents. But just being curious about what happens to the customers on older versions. |
Hey @lenin-jaganathan , |
Currently our
WeakConcurrentMap
is only cleaned of stale entries when it is accessed. There is an option to clean from a background thread, but this creates a separate thread for every map. This pr introduces a single background thread that cleans all maps.I removed the option to create a thread per map as we don't use it, if there is interest I could attempt to find a way to add it back.