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 3 ... 8

Author Topic: Re: upredictable memory leak  (Read 15116 times)

zekkerj

  • Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 25
Re: upredictable memory leak
« on: December 27, 2010, 05:32:08 AM »

Hi,
Sorry to dig up the thread but a few months back here my amule has caused memory leak. My system has 2GiB of RAM, and  8GiB swap.
amule runs fine for hours, sometimes days, then suddenly starts to allocate memory desperately, until it wipes out all memory and make the system hang. To lessen the problem, I set a 3GiB limit per process. Now at least the system survives the failure of amule.

I would really like to fix this.

aMule 2.2.6 using wxGTK2 v2.8.10 (OS: Linux)

Kubuntu 10.04
Kernel 2.6.32-27-49-generic x86_64

I suppose I should gather some backtraces of failure, where should I start?

Oh, one detail: the failure began to appear after I changed my 1Mbps connection by another of 15Mbps (God bless my ISP). Not sure if it didn't happened before, but now it's much more frequent.
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3830
  • Engines screaming
Re: upredictable memory leak
« Reply #1 on: December 27, 2010, 02:08:34 PM »

That's not related, so I made a new thread for it.
Sounds like the RRM problem. Please try the SVN version. There is a fix for a memleak on high bandwidth in it.
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

zekkerj

  • Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 25
Re: Re: upredictable memory leak
« Reply #2 on: December 31, 2010, 05:53:40 AM »

OK. Downloaded "aMule-SVN-r10381". Compiled OK.

I'm giving it a try, right now.

Thanks.
Logged

zekkerj

  • Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 25
Re: Re: upredictable memory leak
« Reply #3 on: December 31, 2010, 02:38:33 PM »

Terminated after throwing an instance of 'std::bad_alloc'
        what(): std::bad_alloc
        backtrace:
[2] ) [0x3647ccad16] in /usr/lib/libstdc++.so.6[0x3647ccad16]
[3] ) [0x3647ccad43] in /usr/lib/libstdc++.so.6[0x3647ccad43]
[4] __cxa_rethrow in /usr/lib/libstdc++.so.6[0x3647ccadc6]
[5] ?? in /usr/local/bin/amule[0x5e3ff2]
[6] ?? in /usr/local/bin/amule[0x5e22f4]
[7] ?? in /usr/local/bin/amule[0x5e0806]
[8] ?? in /usr/local/bin/amule[0x5deb7c]
[9] ?? in /usr/local/bin/amule[0x5dcdea]
[10] ?? in /usr/local/bin/amule[0x5db126]
[11] ?? in /usr/local/bin/amule[0x5d98a0]
[12] wxThreadInternal::PthreadStart(wxThread*) in /usr/lib/libwx_baseu-2.8.so.0[0x3640ee8111]
[13] ?? in /lib/libpthread.so.0[0x7f99b6a129ca]
[14] clone in /lib/libc.so.6[0x7f99b64ec70d]
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3830
  • Engines screaming
Re: upredictable memory leak
« Reply #4 on: December 31, 2010, 02:55:02 PM »

So it's not that. (You should compile with debug symbols to get a useful backtrace, but with bad_alloc it's useless anyway.) Hm.
Quote
Kubuntu 10.04
Kernel 2.6.32-27-49-generic x86_64
Is that a recent kernel (a few weeks old)? Can you boot from an older kernel instead? We are having oom problems with recent Ubuntu kernels, mostly in 10.10 though.
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

zekkerj

  • Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 25
Re: Re: upredictable memory leak
« Reply #5 on: December 31, 2010, 02:58:35 PM »

Yes, it's recent, but the problem ocurred in very same way in the other kernels (2.6.32 22-25).
By the way, was this BT useful? Or should I change the compile directives to make it better?
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3830
  • Engines screaming
Re: upredictable memory leak
« Reply #6 on: December 31, 2010, 03:55:36 PM »

Well, when the program runs out of memory, the problem is where the memory is wasted, not where it finally runs out.
Otoh, chances are you can catch the actual waster. Probably the upload thread I think.
Yes, please compile with debug infos enabled and run it from gdb, as described in the sticky in the backtrace board.
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

yastahta

  • Newbie
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 5
Re: upredictable memory leak
« Reply #7 on: December 31, 2010, 04:33:12 PM »

Im archlinux 64bit user. I tried last svn tarball and last stable release. There is a memory problem it s certain. After running for a while, amule starts trashing hdds and uses more and more ram till amule crash when reaching ram's hardware limit.

I recompile amule's versions with debug option but there s nothing to share about problem.

And indeed this is important problem to make amule useless. I read 10417's "Fix possible memleak in CKademliaUDPListener::ProcessSearchResponse()" log but there are another problem about memory leak.
Logged

zekkerj

  • Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 25
Re: Re: upredictable memory leak
« Reply #8 on: December 31, 2010, 05:31:22 PM »

is there any chance that the problem be related to search? I have a feeling (i.e. I never confirmed this reasonably) that amule only crashes if I use the search (global and/or kad).
Logged

yastahta

  • Newbie
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 5
Re: upredictable memory leak
« Reply #9 on: December 31, 2010, 07:07:54 PM »

I thought same thing, and I left amule working without any searching and crashed again.
Logged

yastahta

  • Newbie
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 5
Re: upredictable memory leak
« Reply #10 on: December 31, 2010, 08:09:23 PM »

In last try I was some sleepy and to be sure, again I tried to use amule without any search and crashed again.
Logged

zekkerj

  • Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 25
Re: Re: upredictable memory leak
« Reply #11 on: December 31, 2010, 08:58:31 PM »

There we go...

Code: [Select]
Program received signal SIGSEGV, Segmentation fault.
__pthread_mutex_lock (mutex=0x7) at pthread_mutex_lock.c:50
50      pthread_mutex_lock.c: Arquivo ou diretório não encontrado.
        in pthread_mutex_lock.c
(gdb) bt
#0  __pthread_mutex_lock (mutex=0x7) at pthread_mutex_lock.c:50
#1  0x0000003644c3e5cf in ?? () from /lib/libglib-2.0.so.0
#2  0x0000003644c40dfe in g_source_remove () from /lib/libglib-2.0.so.0
#3  0x000000364b9e4c36 in GSocketGUIFunctionsTableConcrete::Uninstall_Callback(GSocket*, GSocketEvent) () from /usr/lib/libwx_gtk2u_core-2.8.so.0
#4  0x0000003641a24b67 in GSocket::Detected_Write() () from /usr/lib/libwx_baseu_net-2.8.so.0
#5  0x000000364b425d3f in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#6  0x0000003644c3e8c2 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#7  0x0000003644c42748 in ?? () from /lib/libglib-2.0.so.0
#8  0x0000003644c42c55 in g_main_loop_run () from /lib/libglib-2.0.so.0
#9  0x000000364f93bbb7 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#10 0x000000364b9e3558 in wxEventLoop::Run() () from /usr/lib/libwx_gtk2u_core-2.8.so.0
#11 0x000000364ba682eb in wxAppBase::MainLoop() () from /usr/lib/libwx_gtk2u_core-2.8.so.0
#12 0x0000003640e8f47c in wxEntry(int&, wchar_t**) () from /usr/lib/libwx_baseu-2.8.so.0
#13 0x000000000064eb38 in main (argc=1, argv=0x7fffffffe258) at amule-gui.cpp:94
(gdb) bt full
#0  __pthread_mutex_lock (mutex=0x7) at pthread_mutex_lock.c:50
        __PRETTY_FUNCTION__ = "__pthread_mutex_lock"
        type = <value optimized out>
#1  0x0000003644c3e5cf in ?? () from /lib/libglib-2.0.so.0
No symbol table info available.
#2  0x0000003644c40dfe in g_source_remove () from /lib/libglib-2.0.so.0
No symbol table info available.
#3  0x000000364b9e4c36 in GSocketGUIFunctionsTableConcrete::Uninstall_Callback(GSocket*, GSocketEvent) () from /usr/lib/libwx_gtk2u_core-2.8.so.0
No symbol table info available.
#4  0x0000003641a24b67 in GSocket::Detected_Write() () from /usr/lib/libwx_baseu_net-2.8.so.0
No symbol table info available.
#5  0x000000364b425d3f in ?? () from /usr/lib/libgdk-x11-2.0.so.0
No symbol table info available.
#6  0x0000003644c3e8c2 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
No symbol table info available.
#7  0x0000003644c42748 in ?? () from /lib/libglib-2.0.so.0
No symbol table info available.
#8  0x0000003644c42c55 in g_main_loop_run () from /lib/libglib-2.0.so.0
No symbol table info available.
#9  0x000000364f93bbb7 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
No symbol table info available.
#10 0x000000364b9e3558 in wxEventLoop::Run() () from /usr/lib/libwx_gtk2u_core-2.8.so.0
No symbol table info available.
#11 0x000000364ba682eb in wxAppBase::MainLoop() () from /usr/lib/libwx_gtk2u_core-2.8.so.0
No symbol table info available.
#12 0x0000003640e8f47c in wxEntry(int&, wchar_t**) () from /usr/lib/libwx_baseu-2.8.so.0
No symbol table info available.
#13 0x000000000064eb38 in main (argc=1, argv=0x7fffffffe258) at amule-gui.cpp:94
No locals.
(gdb) thread apply all bt

Thread 6 (Thread 0x7ffff3369700 (LWP 16812)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:211
#1  0x0000003640ee6a16 in wxConditionInternal::WaitTimeout(unsigned long) () from /usr/lib/libwx_baseu-2.8.so.0
#2  0x0000003640ee79e7 in wxSemaphoreInternal::WaitTimeout(unsigned long) () from /usr/lib/libwx_baseu-2.8.so.0
#3  0x0000000000796d64 in CTimerThread::Entry (this=0x7fffec0008f0) at Timer.cpp:66
#4  0x0000003640ee8111 in wxThreadInternal::PthreadStart(wxThread*) () from /usr/lib/libwx_baseu-2.8.so.0
#5  0x00007ffff7bc69ca in start_thread (arg=<value optimized out>) at pthread_create.c:300
#6  0x00007ffff76a070d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#7  0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7ffff436b700 (LWP 16809)):
#0  0x00007ffff7bcf11d in nanosleep () at ../sysdeps/unix/syscall-template.S:82
#1  0x0000003640eeda5c in wxMicroSleep(unsigned long) () from /usr/lib/libwx_baseu-2.8.so.0
#2  0x00000000005d95ae in UploadBandwidthThrottler::Entry (this=0x1cb33f0) at UploadBandwidthThrottler.cpp:323
#3  0x0000003640ee8111 in wxThreadInternal::PthreadStart(wxThread*) () from /usr/lib/libwx_baseu-2.8.so.0
#4  0x00007ffff7bc69ca in start_thread (arg=<value optimized out>) at pthread_create.c:300
#5  0x00007ffff76a070d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#6  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7ffff7fbe800 (LWP 16799)):
#0  __pthread_mutex_lock (mutex=0x7) at pthread_mutex_lock.c:50
#1  0x0000003644c3e5cf in ?? () from /lib/libglib-2.0.so.0
#2  0x0000003644c40dfe in g_source_remove () from /lib/libglib-2.0.so.0
#3  0x000000364b9e4c36 in GSocketGUIFunctionsTableConcrete::Uninstall_Callback(GSocket*, GSocketEvent) () from /usr/lib/libwx_gtk2u_core-2.8.so.0
#4  0x0000003641a24b67 in GSocket::Detected_Write() () from /usr/lib/libwx_baseu_net-2.8.so.0
#5  0x000000364b425d3f in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#6  0x0000003644c3e8c2 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#7  0x0000003644c42748 in ?? () from /lib/libglib-2.0.so.0
#8  0x0000003644c42c55 in g_main_loop_run () from /lib/libglib-2.0.so.0
#9  0x000000364f93bbb7 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#10 0x000000364b9e3558 in wxEventLoop::Run() () from /usr/lib/libwx_gtk2u_core-2.8.so.0
#11 0x000000364ba682eb in wxAppBase::MainLoop() () from /usr/lib/libwx_gtk2u_core-2.8.so.0
#12 0x0000003640e8f47c in wxEntry(int&, wchar_t**) () from /usr/lib/libwx_baseu-2.8.so.0
#13 0x000000000064eb38 in main (argc=1, argv=0x7fffffffe258) at amule-gui.cpp:94
(gdb)

Interestingly, now I've got a "Segmentation Violation". Is this error wxGTK related?
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3830
  • Engines screaming
Re: upredictable memory leak
« Reply #12 on: January 01, 2011, 02:52:37 PM »

People, anything bad can happen when you are running out of memory.

OK. Can you try a few things to help track the problem down:
- Try latest SVN. I have plugged a memory leak in 10417, though I doubt it was The Big One.
- Try amuled with amulegui instead of amule, to see if it makes a difference. If it crashes - which of the two uses up the memory?
- Try amule but disable Kad, use only ED2K.
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

yastahta

  • Newbie
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 5
Re: upredictable memory leak
« Reply #13 on: January 01, 2011, 08:38:23 PM »

I tried KAD disabled and it crashed again. Now amuled with  amulegui is working for a while. I ll report what ll happen.
Logged

yastahta

  • Newbie
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 5
Re: upredictable memory leak
« Reply #14 on: January 01, 2011, 10:06:27 PM »

still both(amuled and amuleguis) is running and still no crash. Normally it should crashed several times in that time.
Logged
Pages: [1] 2 3 ... 8