aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Pages: [1] 2

Author Topic: Serious Memory Leak  (Read 11775 times)

jpv950

  • Jr. Member
  • **
  • Karma: 2
  • Offline Offline
  • Posts: 59
Serious Memory Leak
« on: April 15, 2009, 01:22:08 AM »

Often when I have amule's window minimized and I restore it (click on the panel bar). it starts leaking memory badly and crashes (or takes down the system if the kernel doesn't kill the process). I suppose it might have something to do with WxWidgets or some other library. Is this a know bug? How can I debug this? Is there a way to see where and how memory is allocated when a process dies?

aMule 2.2.4 compiled from source using Ubuntu 9.04 beta (Linux 2.6.28-11-generic #41-Ubuntu SMP x86_64 GNU/Linux).
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: Serious Memory Leak
« Reply #1 on: April 18, 2009, 07:04:08 PM »

How many cats do you have ?
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: Serious Memory Leak
« Reply #2 on: April 18, 2009, 08:19:58 PM »



?
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: Serious Memory Leak
« Reply #3 on: April 18, 2009, 09:51:55 PM »

Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

jpv950

  • Jr. Member
  • **
  • Karma: 2
  • Offline Offline
  • Posts: 59
Re: Serious Memory Leak
« Reply #4 on: May 02, 2009, 11:50:51 PM »

No cats. Anything else I forgot to mention?

:D

http://www.amule.org/amule/index.php?topic=16785.0

Not sure why you linked to that, it is not similar at all to what I'm experiencing.

EDIT: Just to be clear, I'm experiencing 100% memory usage. This is a serious bug that happens not infrequently and brings down the whole system. Memory exhaustion protection with the Linux kernel is awfully inadequate from my brief research.
« Last Edit: May 03, 2009, 12:14:24 AM by jpv950 »
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: Serious Memory Leak
« Reply #5 on: May 03, 2009, 12:20:44 AM »

Just wanted to rule that issue out.
How do you know it's leaking memory? Do you get any backtrace?
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

jpv950

  • Jr. Member
  • **
  • Karma: 2
  • Offline Offline
  • Posts: 59
Re: Serious Memory Leak
« Reply #6 on: May 03, 2009, 04:07:55 AM »

Just wanted to rule that issue out.
How do you know it's leaking memory? Do you get any backtrace?

I have the Gnome system monitor applet showing the memory usage. It's not even leaking memory, it's gobbling memory. Memory usage shoots to 100% very fast (I have 4GiB of RAM), then it fills the swap file and the system hangs. I don't even have time to kill the process manually.

It's probably not a bug in aMule itself though, I just wanted to know if anyone else was having this issue and how to get a backtrace.
« Last Edit: May 03, 2009, 04:21:13 AM by jpv950 »
Logged

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: Serious Memory Leak
« Reply #7 on: May 03, 2009, 06:37:00 PM »

Have you compiled wx from source?
Logged

jpv950

  • Jr. Member
  • **
  • Karma: 2
  • Offline Offline
  • Posts: 59
Re: Serious Memory Leak
« Reply #8 on: May 05, 2009, 10:11:11 PM »

Have you compiled wx from source?

Not since upgrading to jaunty. I got a backtrace by setting ulimit in the shell.

Code: [Select]
Unexpected error.

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7f6f83e227e0 (LWP 13468)]
0x00007f6f80c72fb5 in raise () from /lib/libc.so.6
(gdb) bt
#0  0x00007f6f80c72fb5 in raise () from /lib/libc.so.6
#1  0x00007f6f80c74bc3 in abort () from /lib/libc.so.6
#2  0x00007f6f80c6bf09 in __assert_fail () from /lib/libc.so.6
#3  0x00007f6f7cce6e90 in _XSend () from /usr/lib/libX11.so.6
#4  0x00007f6f7cce6f21 in _XReply () from /usr/lib/libX11.so.6
#5  0x00007f6f7ccc4246 in XGetWindowProperty () from /usr/lib/libX11.so.6
#6  0x00007f6f80202210 in gdk_window_get_frame_extents ()
   from /usr/lib/libgdk-x11-2.0.so.0
#7  0x00007f6f8020284b in gdk_window_get_root_origin ()
   from /usr/lib/libgdk-x11-2.0.so.0
#8  0x00007f6f820ffc12 in ?? () from /usr/lib/libwx_gtk2u_core-2.8.so.0
#9  0x00007f6f8057bdf8 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#10 0x00007f6f7ef7d27d in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#11 0x00007f6f7ef92e3b in ?? () from /usr/lib/libgobject-2.0.so.0
#12 0x00007f6f7ef942bd in g_signal_emit_valist ()
   from /usr/lib/libgobject-2.0.so.0
#13 0x00007f6f7ef94953 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#14 0x00007f6f8068409e in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#15 0x00007f6f80575811 in gtk_main_do_event ()
   from /usr/lib/libgtk-x11-2.0.so.0
#16 0x00007f6f801eef3c in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#17 0x00007f6f7e6d420a in g_main_context_dispatch ()
   from /usr/lib/libglib-2.0.so.0
---Type <return> to continue, or q <return> to quit---
#18 0x00007f6f7e6d78e0 in ?? () from /usr/lib/libglib-2.0.so.0
#19 0x00007f6f7e6d7dad in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#20 0x00007f6f80575bc7 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#21 0x00007f6f820f5068 in wxEventLoop::Run ()
   from /usr/lib/libwx_gtk2u_core-2.8.so.0
#22 0x00007f6f8217e57b in wxAppBase::MainLoop ()
   from /usr/lib/libwx_gtk2u_core-2.8.so.0
#23 0x00007f6f81a16a8d in wxEntry () from /usr/lib/libwx_baseu-2.8.so.0
#24 0x0000000000683589 in main (argc=1, argv=0x7fff8be5d2d8)
    at amule-gui.cpp:95
Logged

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: Serious Memory Leak
« Reply #9 on: May 05, 2009, 10:51:10 PM »

Correlation != causation.
Logged

jpv950

  • Jr. Member
  • **
  • Karma: 2
  • Offline Offline
  • Posts: 59
Re: Serious Memory Leak
« Reply #10 on: May 06, 2009, 12:50:36 AM »

Correlation != causation.

I take it you mean the backtrace may not be related to this bug, but I think there is causation.

bug => amule memory usage jumps over ~2GB RAM => ulimit -v ~2GB exceeded => abort when allocating more memory

Under normal circumstances the memory usage never gets so high and the usage pattern I saw was the same as before when the system hung up (excepted the process aborted this time). Also, the crash happened again when "unminimizing" the window and the buggy call is somewhere in the wxGTK mainloop, as would be expected.

If you mean this might not happen if compiling wxGTK from source, true enough.
Logged

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: Serious Memory Leak
« Reply #11 on: May 06, 2009, 12:53:34 AM »

It probably won't. Please try.
Logged

jpv950

  • Jr. Member
  • **
  • Karma: 2
  • Offline Offline
  • Posts: 59
Re: Serious Memory Leak
« Reply #12 on: May 06, 2009, 01:17:12 AM »

I will.

I noticed this only happens when I leave the window minimized for a long time, typically overnight or after being away for the day. This makes me suspect libX11 because it seems more time dependent than the rest of the stack. It could be looping on XGetWindowProperty(). Maybe the window property gets lost after some hours. If the problem was in wx I'd expect it would be more likely to happen every time the window is unminimized. Just a thought.
Logged

jpv950

  • Jr. Member
  • **
  • Karma: 2
  • Offline Offline
  • Posts: 59
Re: Serious Memory Leak
« Reply #13 on: May 06, 2009, 04:47:22 AM »

Actually I suspect this is happening because I had redefined my $HOME variable to point somewhere else when running amule, to use the same settings from different systems sharing a partition and completely forgot about it until now. I have compiled wx from source too and I'll confirm later if this is solved (still a bug in the libraries though, even if it is).

Is there a safe runtime way to move $HOME/.aMule somewhere else?

This reminds me, it'd be nice if amule followed freedesktop's Base Directory Specification.
Logged

jpv950

  • Jr. Member
  • **
  • Karma: 2
  • Offline Offline
  • Posts: 59
Re: Serious Memory Leak
« Reply #14 on: May 10, 2009, 05:38:57 AM »

Problem solved, see above. Root cause is a D-Bus session error I think. SVN build with wxGTK 2.8.10 seems very stable, no errors or warnings whatsoever. I might even try the dreaded system tray icon now.
Logged
Pages: [1] 2