Skip to content
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

Memory leak in Network #1220

Closed
egbertbouman opened this issue Oct 12, 2023 · 1 comment · Fixed by #1221
Closed

Memory leak in Network #1220

egbertbouman opened this issue Oct 12, 2023 · 1 comment · Fixed by #1221
Assignees
Labels
priority: high Bugs, broken functionality or critical features

Comments

@egbertbouman
Copy link
Member

When letting IPv8 run for about 1,5 days, I'm seeing a lot of IPv4 addresses in the Network class. For instance, in Network.reverse_intro_lookup I have 2009 keys (despite the 500 cache limit), while the total sum of all objects in the lists is 113163.

Memory leaks in other dicts within this class may also exist, but so far I've only seen issues with reverse_intro_lookup.

Note that despite these numbers, it takes a while before this actually has a significant impact on memory usage. This will only affect users who run IPv8 24/7.

@egbertbouman egbertbouman added the priority: unknown Requires further investigation label Oct 12, 2023
@qstokkink qstokkink added priority: high Bugs, broken functionality or critical features and removed priority: unknown Requires further investigation labels Oct 12, 2023
@qstokkink
Copy link
Collaborator

Thanks for this report. It seems that the reverse_intro_lookup does not respect the cache size when adding peers here:

else:
self.reverse_intro_lookup[peer] = [address]

It is supposed to check the current cache size and pop old peers when the cache limit is reached, like this:

self.reverse_intro_lookup[peer] = introductions
if len(self.reverse_intro_lookup) > self.reverse_intro_cache_size:
self.reverse_intro_lookup.popitem(False) # Pop the oldest cache entry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high Bugs, broken functionality or critical features
Development

Successfully merging a pull request may close this issue.

2 participants