-
Notifications
You must be signed in to change notification settings - Fork 26
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
Needs more than two gigabyte RAM if running for two days #52
Comments
It seems that it's freezing computers that don't have any free RAM anymore. Nyx caused a totalfreeze the day before yesterday. |
After running it for an hour it chomped through a large portion of my free memory. |
it appears to be a stem issue rather than a nyx issue. |
What made you conclude that? Thus far there doesn't appear to be much actionable information on this ticket. |
I ran a memory profiler on nyx to try to figure out who's hugging all the memory. #!/usr/bin/env python3
import nyx.starter
import sys
def main():
try:
nyx.starter.main()
except ImportError as exc:
print("Unable to start nyx: %s" % exc)
sys.exit(1)
if __name__ == "__main__":
main()
stem comes from whatever version apt is pulling in for nyx on ubuntu 22.04(its stem 1.8.0). The nyx code I used was against latest commit on the master branch (commit dcaddf2). |
So someone would have to open an issue there instead. Will anyone do it? |
That's a neat visualization. Thanks Farzad! Unfortunately it doesn't narrow down the haystack much. It indicates that Nyx makes copious get_info and get_conf calls which is expected. Memory issues are particularly thorny to track down. My first thought is 'why now?', by which I mean that Nyx and Stem were released in 2019. If I still worked at Tor I'd start by checking with the wider community to see how prevalent this issue is.
Honestly it doesn't matter. I'm the author of both Stem and Nyx. I left Tor a couple years ago whereupon Georg (gk at torproject dot org) took over but he doesn't monitor GitHub. You'll need to email him if you'd like to get his attention (see this issue for the latest discussion on that). You can also try tor-dev@. TL;DR: Nyx and Stem are presently unmaintained. I'm sorry I don't have better news for you. |
I could make a bunch of containers with different versions for everything and see when we actually run into this issue. |
I'd like to reproduce your result, however you seem to use a different version of memray.
Do you by chance know what went wrong? it doesn't make any sense:
|
my bad. it should be |
My idea is that Unfortunately it is very hard to debug this code, especially because of its size.
and
So I assume that some function calls remain in the memory. It is interesting that I can not observe that memory leak on my Fedora system. For how long have you been running it? I've run it for 30 minutes. Maybe that wasn't enough and now my ssh connection broke. Has anyone got a better idea? Is anyone still interested? |
the memory leak is not a matter of how long. it is a constant leakage. you can see that it keep increasing periodically by a very small amount. it gets big over time. |
here's a flamegraph that memray has made for a "leaky" session if anybody wants to take a look: |
What is this supposed to be - there are surely some files missing? |
I am not sure if there is a leak, what I know is it ran fine for 30 minutes, which is not an extreme time.
|
its probably because of the nginx settings that I have for that file server. just download the html file and open it then. its around 26 MB. that should fix it. |
Python and nyx version are the same. stem is v 1.8.0.
I am running nyx in a conainter: FROM fedora:34
RUN dnf update -y && dnf install -y nyx But I am still using a lot of memory. 155 MB in 6 hours. |
You mentioned 155MB in 6 hours. Maybe I did not run it long enough...
I'll run it for 24 hours then, to check if I really do not experience any issues. You could as well as me try to use the official tor repositories and fedora 37, and check if there are issues with that. |
Can not reproduce the memory leak anymore. |
quote @atagar
Try this if you want to see this fixed. |
Conducted another test of nyx and recorded some results that could be of use if anyone wants to take up further investigation. Nyx was started on a Debian 12 system with Tor 0.4.8.11, nyx commit This system was configured as a gateway with transparent-proxying and SOCKS ports. Traffic comprising of many discrete circuits was generated by a client. After some time the client system was shut down and NEWNYM was sent to the Tor control-port. The memory usage did not decrease substantially Memory usage of nyx before stress-test. (ps aux)
Memory usage of nyx after stress-test.
Conclusion: The memory leak still occurs under conditions of stress when testing present versions of utilities in question. |
Nyx seems to have a memory leak. If it runs for a long time it will consume my whole swap. This time it ran 2 days only and needs 3GB swap and 1GB RAM of and won't close until the swap is freed or you press ctrl+c multiple times.
The text was updated successfully, but these errors were encountered: