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

ubuntu 18.04 LTS, ram filling up completely #5934

Closed
paul-rf opened this issue Jan 12, 2021 · 12 comments · Fixed by #5949
Closed

ubuntu 18.04 LTS, ram filling up completely #5934

paul-rf opened this issue Jan 12, 2021 · 12 comments · Fixed by #5949

Comments

@paul-rf
Copy link

paul-rf commented Jan 12, 2021

Hi,
I installed tribler 7.7.0 last friday (downloaded deb file, installation via Ubuntu sw centre) on a ubuntu 18.04 LTS PC as alternative to transmission. Every day I had to reboot the PC as it was completely stuck. Yesterday I started following RAM: after starting tribler I get 4 entries in the list (I have a couple of active torrents), of which 1 starts at ~100 MB RAM, and this continues to grow until the RAM (5 GB in my case) is completely filled up. This morning I stopped tribler, and restarted, but the same behaviour is still there. After installing 7.7.1 and starting today I still see RAM-usage increasing (from 150 M at 14:00 today, to 1.8 G at 18:00).

I am running remmina as remote terminal for the ubuntu 18.04 LTS PC, on a laptop running ubuntu 20.04 LTS, but I cannot imagine that that causes the problem.

Is this expected behaviour? What maximum RAM-usage do you expect from tribler?

I saw a similar problem (issue 2123, 22-4-2016), but I would expect this to be solved in the mean time.

Let me know if you need more information.

@Davem734
Copy link

Can confirm.
Problem started with v7.7.0 and still a problem with v7.7.1
Fills up 32Gb of memory after a few hours.
Ubuntu 18.04.5
Python 3.8.5

@Davem734
Copy link

Tribler launches four processes.
It is the second (based on PID order) of the four processes that has the memory issue...

@xoriole xoriole added this to the 7.8.0 January milestone Jan 13, 2021
@xoriole xoriole self-assigned this Jan 13, 2021
@xoriole
Copy link
Contributor

xoriole commented Jan 13, 2021

@paul-rf @Davem734 Thank you for reporting and confirming. Currently, Tribler does not set an upper bound on memory usage, but we should cap that and fix the root cause of memory leak. Prioritizing the issue for the release.

@synctext
Copy link
Member

wow 32GBytes! That should be easy to locate, thnx!

@egbertbouman
Copy link
Member

When I go back before 9d8f961, the GUI process doesn't leak for me anymore. The leak seems to be related to the signal handlers.

@qstokkink
Copy link
Contributor

qstokkink commented Jan 14, 2021

Inspected gc, this function is leaking:

def trackback_wrapper(*args, **kwargs):

Click me for dirty patch that hooks into the debug window log refresh button to dump the top 5 most-referenced GUI process objects into "memobjs.txt".
diff --git a/src/tribler-gui/tribler_gui/debug_window.py b/src/tribler-gui/tribler_gui/debug_window.py
index ab8c65759..1da1f1b75 100644
--- a/src/tribler-gui/tribler_gui/debug_window.py
+++ b/src/tribler-gui/tribler_gui/debug_window.py
@@ -122,6 +122,9 @@ class DebugWindow(QMainWindow):
         self.rest_request = None
         self.ipv8_health_widget = None
 
+        with open("memobjs.txt", 'w') as f:
+            f.write("")
+
     def hideEvent(self, hide_event):
         self.stop_timer()
         self.hide_ipv8_health_widget()
@@ -771,6 +774,19 @@ class DebugWindow(QMainWindow):
             self.memory_plot_timer.stop()
 
     def load_logs_tab(self):
+        import gc
+        obj_dump = gc.get_objects()
+        out = {}
+        for obj in obj_dump:
+            try:
+                if hasattr(obj, "__code__"):
+                    key = obj.__code__.co_filename + "-" + str(obj.__code__.co_firstlineno)
+                    out[key] = out.get(key, 0) + 1
+            except Exception:
+                pass
+        with open("memobjs.txt", 'a') as f:
+            f.write(repr([repr(k) + "-" + repr(v) for k, v in sorted(out.items(), key=lambda item: item[1])[-5:]]) + "\n")
+        return
         # Max lines from GUI
         max_log_lines = self.window().max_lines_value.text()
 

kozlovsky added a commit to kozlovsky/tribler that referenced this issue Jan 14, 2021
@ichorid
Copy link
Contributor

ichorid commented Jan 18, 2021

According to this report from our forum, the user experiences a leak and a crash on the GUI side. The Core continues to run as normal. I guess it points us to the GUI leaking.

xoriole pushed a commit to xoriole/tribler that referenced this issue Jan 18, 2021
@Davem734
Copy link

I noticed that the leak seems to stop (or really slow down) if I am not displaying the "downloads" page...

kozlovsky added a commit to kozlovsky/tribler that referenced this issue Jan 19, 2021
@kozlovsky
Copy link
Collaborator

According to @xoriole experiments, it seems PR #5940 is able to fix the major memory leak, but some minor memory leak still presents. Further debugging is necessary to discover other reasons for memory leaks.

@kozlovsky
Copy link
Collaborator

The issue was auto-closed by commit message, but I'm reopening it, as the memory leak was not completely fixed yet

@kozlovsky kozlovsky reopened this Jan 19, 2021
@qstokkink
Copy link
Contributor

Perhaps it would be a good idea to focus some effort on implementing #3603 into the debug screen so we can see what objects are actually leaking.

@sentry-for-tribler
Copy link

Sentry issue: SENTRY-FOR-760-28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants