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] 4 5 ... 8

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

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: upredictable memory leak
« Reply #30 on: January 10, 2011, 11:34:04 PM »

OK, I can see I've got some more room to maneuver. I'll have to do some code reading while you are watching all your new porn.  ;D
(Your first backtrace is pointing at a very silly piece of code btw.)
I'll get back to you when I find something. It may take a while.
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

btkaos

  • Global Moderator
  • Sr. Member
  • *****
  • Karma: 110
  • Offline Offline
  • Posts: 486
  • Kaos is infinite!
Re: upredictable memory leak
« Reply #31 on: January 10, 2011, 11:39:30 PM »

Quote
(Your first backtrace is pointing at a very silly piece of code btw.)
I have a script that sends a INT signal when aMule reaches 2Gb of RSS, of course it is a random bt.
Quote
I'll get back to you when I find something. It may take a while.
Perfect, I'm also having a look. Keep in mind the all my statments are inferred from occassional crashes, so not very conclusive. Indeed it could be a build problem or whatever else.
Logged

btkaos

  • Global Moderator
  • Sr. Member
  • *****
  • Karma: 110
  • Offline Offline
  • Posts: 486
  • Kaos is infinite!
Re: upredictable memory leak
« Reply #32 on: January 11, 2011, 12:00:54 AM »

Well, I'll keep all my posts in this thread.

Situation: svn amule (10424) + oomlog patch + local wx. All built with debug mode and optimization enabled. Very high load, capable of donwloading about 1Mb/s, limited to 100Kb/s

I get a Sigsev, normal memory consumption.
Code: [Select]
2011-01-10 23:52:33: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 2 TCQF 0 SO 15 EMS 215
 2011-01-10 23:52:37: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 2 TCQF 0 SO 15 EMS 208
 2011-01-10 23:52:40: UploadBandwidthThrottler.cpp(311): UBT: t 1 CQ 0 CQF 0 TCQ 3 TCQF 0 SO 15 EMS 220
 2011-01-10 23:52:44: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 2 TCQF 0 SO 15 EMS 220
 2011-01-10 23:52:47: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 2 TCQF 0 SO 15 EMS 214
 2011-01-10 23:52:50: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 2 TCQF 0 SO 15 EMS 222
 2011-01-10 23:52:54: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 2 TCQF 0 SO 15 EMS 230
 2011-01-10 23:52:58: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 2 TCQF 0 SO 15 EMS 229
 2011-01-10 23:53:02: UploadBandwidthThrottler.cpp(311): UBT: t 1 CQ 0 CQF 0 TCQ 0 TCQF 0 SO 15 EMS 212
 2011-01-10 23:53:05: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 2 TCQF 0 SO 15 EMS 220
 2011-01-10 23:53:24: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 7 TCQF 0 SO 15 EMS 216
 2011-01-10 23:53:24: UploadBandwidthThrottler.cpp(311): UBT: t 1 CQ 0 CQF 0 TCQ 7 TCQF 0 SO 15 EMS 216
 2011-01-10 23:53:24: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 7 TCQF 0 SO 15 EMS 216
 2011-01-10 23:53:24: UploadBandwidthThrottler.cpp(311): UBT: t 1 CQ 0 CQF 0 TCQ 7 TCQF 0 SO 15 EMS 216
 2011-01-10 23:53:26: UploadBandwidthThrottler.cpp(311): UBT: t 1 CQ 39 CQF 0 TCQ 1 TCQF 0 SO 15 EMS 215
 2011-01-10 23:53:27: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 38 CQF 0 TCQ 0 TCQF 0 SO 15 EMS 186
 2011-01-10 23:53:29: UploadBandwidthThrottler.cpp(311): UBT: t 1 CQ 3 CQF 10 TCQ 0 TCQF 0 SO 15 EMS 204
 2011-01-10 23:53:32: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 4 TCQF 0 SO 15 EMS 204
 2011-01-10 23:53:35: UploadBandwidthThrottler.cpp(311): UBT: t 1 CQ 0 CQF 0 TCQ 2 TCQF 0 SO 15 EMS 194
 2011-01-10 23:53:39: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 3 TCQF 0 SO 15 EMS 212
 2011-01-10 23:53:42: UploadBandwidthThrottler.cpp(311): UBT: t 1 CQ 0 CQF 0 TCQ 3 TCQF 1 SO 15 EMS 213
 2011-01-10 23:53:45: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 0 TCQF 0 SO 15 EMS 220
 2011-01-10 23:53:51: UploadBandwidthThrottler.cpp(311): UBT: t 1 CQ 0 CQF 0 TCQ 0 TCQF 2 SO 15 EMS 219
 2011-01-10 23:53:53: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 3 TCQF 5 SO 15 EMS 226
 2011-01-10 23:53:56: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 3 CQF 0 TCQ 1 TCQF 12 SO 15 EMS 235
 2011-01-10 23:53:59: UploadBandwidthThrottler.cpp(311): UBT: t 1 CQ 8 CQF 23 TCQ 0 TCQF 31 SO 15 EMS 237
 2011-01-10 23:54:03: UploadBandwidthThrottler.cpp(311): UBT: t 1 CQ 0 CQF 0 TCQ 1 TCQF 84 SO 15 EMS 242
 2011-01-10 23:54:17: UploadBandwidthThrottler.cpp(311): UBT: t 2 CQ 0 CQF 0 TCQ 0 TCQF 106 SO 15 EMS 243
 2011-01-10 23:54:17: UploadBandwidthThrottler.cpp(311): UBT: t 1 CQ 0 CQF 0 TCQ 0 TCQF 106 SO 15 EMS 243
 2011-01-10 23:54:17: UploadBandwidthThrottler.cpp(311): UBT: t 2 CQ 0 CQF 0 TCQ 0 TCQF 106 SO 15 EMS 244
 2011-01-10 23:54:21: UploadBandwidthThrottler.cpp(311): UBT: t 5 CQ 0 CQF 0 TCQ 3 TCQF 124 SO 15 EMS 211
 2011-01-10 23:54:23: UploadBandwidthThrottler.cpp(311): UBT: t 17 CQ 0 CQF 0 TCQ 1 TCQF 134 SO 15 EMS 211
 2011-01-10 23:54:26: UploadBandwidthThrottler.cpp(311): UBT: t 1 CQ 0 CQF 0 TCQ 0 TCQF 184 SO 15 EMS 207
 2011-01-10 23:54:32: UploadBandwidthThrottler.cpp(311): UBT: t 6 CQ 0 CQF 0 TCQ 0 TCQF 194 SO 15 EMS 209
 2011-01-10 23:54:35: UploadBandwidthThrottler.cpp(311): UBT: t 2 CQ 0 CQF 0 TCQ 0 TCQF 302 SO 15 EMS 209
 2011-01-10 23:54:38: UploadBandwidthThrottler.cpp(311): UBT: t 3 CQ 0 CQF 0 TCQ 0 TCQF 386 SO 15 EMS 195
 2011-01-10 23:54:44: UploadBandwidthThrottler.cpp(311): UBT: t 5 CQ 0 CQF 0 TCQ 1 TCQF 460 SO 15 EMS 208
 2011-01-10 23:54:45: UploadBandwidthThrottler.cpp(311): UBT: t 4 CQ 3 CQF 0 TCQ 1 TCQF 518 SO 15 EMS 205
 2011-01-10 23:54:51: UploadBandwidthThrottler.cpp(311): UBT: t 7 CQ 0 CQF 0 TCQ 0 TCQF 552 SO 15 EMS 220
 2011-01-10 23:54:53: UploadBandwidthThrottler.cpp(311): UBT: t 7 CQ 0 CQF 0 TCQ 0 TCQF 563 SO 15 EMS 227
 2011-01-10 23:55:02: UploadBandwidthThrottler.cpp(311): UBT: t 9 CQ 0 CQF 0 TCQ 0 TCQF 695 SO 15 EMS 231
 2011-01-10 23:55:02: UploadBandwidthThrottler.cpp(311): UBT: t 7 CQ 0 CQF 0 TCQ 0 TCQF 695 SO 15 EMS 231
 2011-01-10 23:55:06: UploadBandwidthThrottler.cpp(311): UBT: t 8 CQ 0 CQF 0 TCQ 0 TCQF 705 SO 15 EMS 232
 2011-01-10 23:55:33: UploadBandwidthThrottler.cpp(311): UBT: t 4 CQ 0 CQF 0 TCQ 0 TCQF 724 SO 15 EMS 228
 2011-01-10 23:55:33: UploadBandwidthThrottler.cpp(311): UBT: t 5 CQ 0 CQF 0 TCQ 0 TCQF 724 SO 15 EMS 228
 2011-01-10 23:55:33: UploadBandwidthThrottler.cpp(311): UBT: t 9 CQ 0 CQF 0 TCQ 0 TCQF 724 SO 15 EMS 228
 2011-01-10 23:55:33: UploadBandwidthThrottler.cpp(311): UBT: t 8 CQ 0 CQF 0 TCQ 0 TCQF 724 SO 15 EMS 228
 2011-01-10 23:55:36: UploadBandwidthThrottler.cpp(311): UBT: t 14 CQ 0 CQF 0 TCQ 1 TCQF 732 SO 15 EMS 207
 2011-01-10 23:55:38: UploadBandwidthThrottler.cpp(311): UBT: t 8 CQ 0 CQF 0 TCQ 0 TCQF 759 SO 15 EMS 156
 2011-01-10 23:55:44: UploadBandwidthThrottler.cpp(311): UBT: t 11 CQ 0 CQF 0 TCQ 0 TCQF 829 SO 15 EMS 163
Code: [Select]
(gdb) bt
#0  __pthread_mutex_lock (mutex=0x7) at pthread_mutex_lock.c:50
#1  0x00007ffff29d004f in g_source_destroy_internal (source=0x7fffe6398db0, context=0xffffffffffffffff, have_lock=0) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:942
#2  0x00007ffff29d290e in g_source_remove (tag=<value optimized out>) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:1717
#3  0x00007ffff67fcc7d in GSocketGUIFunctionsTableConcrete::Uninstall_Callback (this=0x7ffff6ccabb0, socket=0x2b2eda0, event=GSOCK_OUTPUT) at ./src/gtk/gsockgtk.cpp:119
#4  0x00007ffff63c37ef in GSocket::Disable (this=0x2b2eda0, event=GSOCK_OUTPUT) at ./src/unix/gsocket.cpp:1527
#5  0x00007ffff63c42f8 in GSocket::Detected_Write (this=0x2b2eda0) at ./src/unix/gsocket.cpp:1836
#6  0x00007ffff67fca1c in _GSocket_GDK_Input (data=0x2b2eda0, source=82, condition=GDK_INPUT_WRITE) at ./src/gtk/gsockgtk.cpp:41
#7  0x00007ffff478e99f in gdk_io_invoke (source=<value optimized out>, condition=<value optimized out>, data=<value optimized out>)
    at /build/buildd/gtk+2.0-2.22.0/gdk/gdkevents.c:1082
#8  0x00007ffff29d0342 in g_main_dispatch (context=0xc67ed0) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2149
#9  g_main_context_dispatch (context=0xc67ed0) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2702
#10 0x00007ffff29d42a8 in g_main_context_iterate (context=0xc67ed0, block=<value optimized out>, dispatch=<value optimized out>, self=<value optimized out>)
    at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2780
#11 0x00007ffff29d47b5 in g_main_loop_run (loop=0x1cb17a0) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2988
#12 0x00007ffff4b4d3e7 in IA__gtk_main () at /build/buildd/gtk+2.0-2.22.0/gtk/gtkmain.c:1237
#13 0x00007ffff67faa5f in wxEventLoop::Run (this=0x1c9ca80) at ./src/gtk/evtloop.cpp:76
#14 0x00007ffff6896cc8 in wxAppBase::MainLoop (this=0xc67930) at ./src/common/appcmn.cpp:312
#15 0x00007ffff6896e42 in wxAppBase::OnRun (this=0xc67930) at ./src/common/appcmn.cpp:367
#16 0x00007ffff606ae5b in wxEntry (argc=@0x7ffff638f4b0, argv=0xc56dd0) at ./src/common/init.cpp:448
#17 0x00007ffff606af31 in wxEntry (argc=@0x7fffffffe0bc, argv=0x7fffffffe1a8) at ./src/common/init.cpp:460
#18 0x00000000005d04c2 in main (argc=1, argv=0x1) at amule-gui.cpp:93

(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  0x00007ffff29d004f in g_source_destroy_internal (source=0x7fffe6398db0, context=0xffffffffffffffff, have_lock=0) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:942
No locales.
#2  0x00007ffff29d290e in g_source_remove (tag=<value optimized out>) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:1717
        source = <value optimized out>
        __PRETTY_FUNCTION__ = "g_source_remove"
#3  0x00007ffff67fcc7d in GSocketGUIFunctionsTableConcrete::Uninstall_Callback (this=0x7ffff6ccabb0, socket=0x2b2eda0, event=GSOCK_OUTPUT) at ./src/gtk/gsockgtk.cpp:119
        m_id = 0x27c6d00
        c = 1
        __PRETTY_FUNCTION__ = "virtual void GSocketGUIFunctionsTableConcrete::Uninstall_Callback(GSocket*, GSocketEvent)"
#4  0x00007ffff63c37ef in GSocket::Disable (this=0x2b2eda0, event=GSOCK_OUTPUT) at ./src/unix/gsocket.cpp:1527
No locales.
#5  0x00007ffff63c42f8 in GSocket::Detected_Write (this=0x2b2eda0) at ./src/unix/gsocket.cpp:1836
No locales.
#6  0x00007ffff67fca1c in _GSocket_GDK_Input (data=0x2b2eda0, source=82, condition=GDK_INPUT_WRITE) at ./src/gtk/gsockgtk.cpp:41
        socket = 0x2b2eda0
#7  0x00007ffff478e99f in gdk_io_invoke (source=<value optimized out>, condition=<value optimized out>, data=<value optimized out>)
    at /build/buildd/gtk+2.0-2.22.0/gdk/gdkevents.c:1082
        closure = 0x7fffe40f0fb0
        gdk_cond = GDK_INPUT_WRITE
#8  0x00007ffff29d0342 in g_main_dispatch (context=0xc67ed0) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2149
        dispatch = 0x7ffff2a14a90 <g_io_unix_dispatch>
        user_data = 0x7fffe40f0fb0
        callback = 0x7ffff478e950 <gdk_io_invoke>
        cb_funcs = 0x7ffff2c70610
        cb_data = 0x7fffe40fe170
        current_source_link = {data = 0x7fffe61c4170, next = 0x0}
        source = 0x7fffe61c4170
        current = 0x1771950
        i = 45
#9  g_main_context_dispatch (context=0xc67ed0) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2702
No locales.
#10 0x00007ffff29d42a8 in g_main_context_iterate (context=0xc67ed0, block=<value optimized out>, dispatch=<value optimized out>, self=<value optimized out>)
    at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2780
        max_priority = 300
        timeout = 0
        some_ready = 1
        nfds = 99
        allocated_nfds = -159537912
        fds = <value optimized out>
        __PRETTY_FUNCTION__ = "g_main_context_iterate"
#11 0x00007ffff29d47b5 in g_main_loop_run (loop=0x1cb17a0) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2988
        self = 0xc67870
        __PRETTY_FUNCTION__ = "g_main_loop_run"
#12 0x00007ffff4b4d3e7 in IA__gtk_main () at /build/buildd/gtk+2.0-2.22.0/gtk/gtkmain.c:1237
        tmp_list = 0x16be450
        functions = 0x0
        init = 0x7fffffffdfd0
        loop = <value optimized out>
#13 0x00007ffff67faa5f in wxEventLoop::Run (this=0x1c9ca80) at ./src/gtk/evtloop.cpp:76
        __FUNCTION__ = "Run"
        activate = {m_evtLoopOld = 0x0}
        exitcode = 32767
#14 0x00007ffff6896cc8 in wxAppBase::MainLoop (this=0xc67930) at ./src/common/appcmn.cpp:312
        mainLoop = {<wxEventLoopPtr> = {m_ptr = 0x1c9ca80}, m_pp = 0xc679a8, m_pOld = 0x0}
#15 0x00007ffff6896e42 in wxAppBase::OnRun (this=0xc67930) at ./src/common/appcmn.cpp:367
No locales.
#16 0x00007ffff606ae5b in wxEntry (argc=@0x7ffff638f4b0, argv=0xc56dd0) at ./src/common/init.cpp:448
        callOnExit = {<No data fields>}
---Type <return> to continue, or q <return> to quit---
        initializer = {m_ok = true}
#17 0x00007ffff606af31 in wxEntry (argc=@0x7fffffffe0bc, argv=0x7fffffffe1a8) at ./src/common/init.cpp:460
No locales.
#18 0x00000000005d04c2 in main (argc=1, argv=0x1) at amule-gui.cpp:93

Logged

btkaos

  • Global Moderator
  • Sr. Member
  • *****
  • Karma: 110
  • Offline Offline
  • Posts: 486
  • Kaos is infinite!
Re: upredictable memory leak
« Reply #33 on: January 11, 2011, 12:01:10 AM »

Code: [Select]
No locales.(gdb) thread apply all bt

Hilo 4 (Thread 0x7fffeb6bc700 (LWP 9659)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:212
#1  0x00007ffff60dbebd in wxConditionInternal::WaitTimeout (this=0x1c9c5d0, milliseconds=100) at ./src/unix/threadpsx.cpp:405
#2  0x00007ffff60dee0f in wxCondition::WaitTimeout (this=0x1c8bc68, milliseconds=100) at ./include/wx/thrimpl.cpp:256
#3  0x00007ffff60dc427 in wxSemaphoreInternal::WaitTimeout (this=0x1c8bc60, milliseconds=100) at ./src/unix/threadpsx.cpp:552
#4  0x00007ffff60df191 in wxSemaphore::WaitTimeout (this=0x178f5d8, milliseconds=100) at ./include/wx/thrimpl.cpp:320
#5  0x00000000006b91dd in CTimerThread::Entry (this=0x178f5a0) at Timer.cpp:66
#6  0x00007ffff60dc705 in wxThreadInternal::PthreadStart (thread=0x178f5a0) at ./src/unix/threadpsx.cpp:766
#7  0x00007ffff60dc5a5 in wxPthreadStart (ptr=0x178f5a0) at ./src/unix/threadpsx.cpp:718
#8  0x00007ffff7bc6971 in start_thread (arg=<value optimized out>) at pthread_create.c:304
#9  0x00007ffff532192d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#10 0x0000000000000000 in ?? ()

Hilo 2 (Thread 0x7fffec6bf700 (LWP 9654)):
#0  0x00007ffff526ed3e in __libc_sigaction (sig=<value optimized out>, act=<value optimized out>, oact=0x7fffec6be400)
    at ../sysdeps/unix/sysv/linux/x86_64/sigaction.c:67
#1  0x00007ffff526eb49 in __bsd_signal (sig=-328473600, handler=<value optimized out>) at ../sysdeps/posix/signal.c:49
#2  0x00007ffff63c3d45 in GSocket::Send_Stream (this=0x293d520, buffer=0x7fffdc3be670 "\234\016\b\204\256\004", size=6) at ./src/unix/gsocket.cpp:1684
#3  0x00007ffff63c2eae in GSocket::Write (this=0x293d520, buffer=0x7fffdc3be670 "\234\016\b\204\256\004", size=6) at ./src/unix/gsocket.cpp:1233
#4  0x00007ffff63bcfa5 in wxSocketBase::_Write (this=0x2713e70, buffer=0x7fffdc3be670, nbytes=6) at ./src/common/socket.cpp:539
#5  0x00007ffff63bcedd in wxSocketBase::Write (this=0x2713e70, buffer=0x7fffdc3be670, nbytes=6) at ./src/common/socket.cpp:507
#6  0x00000000006814ee in CSocketClientProxy::Write (this=0x2713e70, buffer=0x7fffdc3be670, nbytes=6) at Proxy.cpp:1309
#7  0x00000000004e3718 in CEncryptedStreamSocket::Write (this=0x2713e70, lpBuf=0x7fffdc3be670, nBufLen=6) at EncryptedStreamSocket.cpp:210
#8  0x00000000004e08a2 in CEMSocket::Send (this=0x2713e70, maxNumberOfBytesToSend=<value optimized out>, minFragSize=<value optimized out>,
    onlyAllowedToSendControlPacket=<value optimized out>) at EMSocket.cpp:577
#9  0x0000000000499382 in CEMSocket::SendControlData (this=0xd, maxNumberOfBytesToSend=3966493520, minFragSize=3966493360) at EMSocket.h:69
#10 0x000000000048dbfb in CClientTCPSocket::SendControlData (this=0xd, maxNumberOfBytesToSend=3966493520, overchargeMaxBytesToSend=3966493360)
    at ClientTCPSocket.cpp:2124
#11 0x00000000005741f4 in UploadBandwidthThrottler::Entry (this=<value optimized out>) at UploadBandwidthThrottler.cpp:401
#12 0x00007ffff60dc705 in wxThreadInternal::PthreadStart (thread=0x1563050) at ./src/unix/threadpsx.cpp:766
#13 0x00007ffff60dc5a5 in wxPthreadStart (ptr=0x1563050) at ./src/unix/threadpsx.cpp:718
#14 0x00007ffff7bc6971 in start_thread (arg=<value optimized out>) at pthread_create.c:304
#15 0x00007ffff532192d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#16 0x0000000000000000 in ?? ()

Hilo 1 (Thread 0x7ffff7fb4940 (LWP 9635)):
#0  __pthread_mutex_lock (mutex=0x7) at pthread_mutex_lock.c:50
#1  0x00007ffff29d004f in g_source_destroy_internal (source=0x7fffe6398db0, context=0xffffffffffffffff, have_lock=0) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:942
#2  0x00007ffff29d290e in g_source_remove (tag=<value optimized out>) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:1717
#3  0x00007ffff67fcc7d in GSocketGUIFunctionsTableConcrete::Uninstall_Callback (this=0x7ffff6ccabb0, socket=0x2b2eda0, event=GSOCK_OUTPUT) at ./src/gtk/gsockgtk.cpp:119
#4  0x00007ffff63c37ef in GSocket::Disable (this=0x2b2eda0, event=GSOCK_OUTPUT) at ./src/unix/gsocket.cpp:1527
#5  0x00007ffff63c42f8 in GSocket::Detected_Write (this=0x2b2eda0) at ./src/unix/gsocket.cpp:1836
#6  0x00007ffff67fca1c in _GSocket_GDK_Input (data=0x2b2eda0, source=82, condition=GDK_INPUT_WRITE) at ./src/gtk/gsockgtk.cpp:41
#7  0x00007ffff478e99f in gdk_io_invoke (source=<value optimized out>, condition=<value optimized out>, data=<value optimized out>)
    at /build/buildd/gtk+2.0-2.22.0/gdk/gdkevents.c:1082
#8  0x00007ffff29d0342 in g_main_dispatch (context=0xc67ed0) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2149
#9  g_main_context_dispatch (context=0xc67ed0) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2702
#10 0x00007ffff29d42a8 in g_main_context_iterate (context=0xc67ed0, block=<value optimized out>, dispatch=<value optimized out>, self=<value optimized out>)
    at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2780
#11 0x00007ffff29d47b5 in g_main_loop_run (loop=0x1cb17a0) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2988
#12 0x00007ffff4b4d3e7 in IA__gtk_main () at /build/buildd/gtk+2.0-2.22.0/gtk/gtkmain.c:1237
#13 0x00007ffff67faa5f in wxEventLoop::Run (this=0x1c9ca80) at ./src/gtk/evtloop.cpp:76
#14 0x00007ffff6896cc8 in wxAppBase::MainLoop (this=0xc67930) at ./src/common/appcmn.cpp:312
#15 0x00007ffff6896e42 in wxAppBase::OnRun (this=0xc67930) at ./src/common/appcmn.cpp:367
#16 0x00007ffff606ae5b in wxEntry (argc=@0x7ffff638f4b0, argv=0xc56dd0) at ./src/common/init.cpp:448
#17 0x00007ffff606af31 in wxEntry (argc=@0x7fffffffe0bc, argv=0x7fffffffe1a8) at ./src/common/init.cpp:460
#18 0x00000000005d04c2 in main (argc=1, argv=0x1) at amule-gui.cpp:93
(gdb) thread apply all bt full

Hilo 4 (Thread 0x7fffeb6bc700 (LWP 9659)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:212
No locales.
#1  0x00007ffff60dbebd in wxConditionInternal::WaitTimeout (this=0x1c9c5d0, milliseconds=100) at ./src/unix/threadpsx.cpp:405
        curtime = {m_ll = 1294700147551}
        temp = {m_ll = 551}
        sec = 1294700147
        millis = 551
        tspec = {tv_sec = 1294700147, tv_nsec = 551000000}
        err = 32767
#2  0x00007ffff60dee0f in wxCondition::WaitTimeout (this=0x1c8bc68, milliseconds=100) at ./include/wx/thrimpl.cpp:256
        __FUNCTION__ = "WaitTimeout"
#3  0x00007ffff60dc427 in wxSemaphoreInternal::WaitTimeout (this=0x1c8bc60, milliseconds=100) at ./src/unix/threadpsx.cpp:552
        elapsed = {m_ll = 0}
        remainingTime = 100
        locker = {m_isOk = true, m_mutex = @0x1c8bc60}
        startTime = {m_ll = 1294700147451}
#4  0x00007ffff60df191 in wxSemaphore::WaitTimeout (this=0x178f5d8, milliseconds=100) at ./include/wx/thrimpl.cpp:320
        __FUNCTION__ = "WaitTimeout"
#5  0x00000000006b91dd in CTimerThread::Entry (this=0x178f5a0) at Timer.cpp:66
        now = 4294966780
        delta = 15271
        evt = {<wxEvent> = {<wxObject> = {_vptr.wxObject = 0x7dfa30, static ms_classInfo = {m_className = 0x7ffff611acc8 L"wxObject", m_objectSize = 16,
                m_objectConstructor = 0, m_baseInfo1 = 0x0, m_baseInfo2 = 0x0, static sm_first = 0x7ffff6ff9ba0, m_next = 0x7ffff6390980, static sm_classTable =
    0xc27010}, m_refData = 0x0}, m_eventObject = 0x0, m_eventType = 10245, m_timeStamp = 0, m_id = 6128, m_callbackUserData = 0x0, m_propagationLevel = 0,
            m_skipped = false, m_isCommandEvent = false, static ms_classInfo = {m_className = 0x7ffff61326c0 L"wxEvent", m_objectSize = 64, m_objectConstructor = 0,
              m_baseInfo1 = 0x7ffff6390880, m_baseInfo2 = 0x0, static sm_first = 0x7ffff6ff9ba0, m_next = 0x7ffff6392880,
              static sm_classTable = 0xc27010}}, <No data fields>}
        lastEvent = 1914991355
#6  0x00007ffff60dc705 in wxThreadInternal::PthreadStart (thread=0x178f5a0) at ./src/unix/threadpsx.cpp:766
        __clframe = {__cancel_routine = 0x7ffff60dc84f <wxPthreadCleanup(void*)>, __cancel_arg = 0x178f5a0, __do_it = 1, __cancel_type = 0}
        pthread = 0xd1d5c0
        rc = 0
        dontRunAtAll = false
        __FUNCTION__ = "PthreadStart"
#7  0x00007ffff60dc5a5 in wxPthreadStart (ptr=0x178f5a0) at ./src/unix/threadpsx.cpp:718
No locales.
#8  0x00007ffff7bc6971 in start_thread (arg=<value optimized out>) at pthread_create.c:304
        __res = <value optimized out>
        pd = 0x7fffeb6bc700
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140737143097088, 2056249433585625392, 140737488346992, 140737143097792, 140737354125376, 3, -2056292213641959120,
                -2056266445640685264}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <value optimized out>
        robust = <value optimized out>
        freesize = <value optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#9  0x00007ffff532192d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
No locales.
#10 0x0000000000000000 in ?? ()
No symbol table info available.

Hilo 2 (Thread 0x7fffec6bf700 (LWP 9654)):
#0  0x00007ffff526ed3e in __libc_sigaction (sig=<value optimized out>, act=<value optimized out>, oact=0x7fffec6be400)
    at ../sysdeps/unix/sysv/linux/x86_64/sigaction.c:67
        result = <value optimized out>
        kact = {k_sa_handler = 0x1, sa_flags = 335544320, sa_restorer = 0x7ffff526ec20 <__restore_rt>, sa_mask = {__val = {4096, 0 <repeats 15 times>}}}
        koact = {k_sa_handler = 0x1, sa_flags = 335544320, sa_restorer = 0x7ffff526ec20 <__restore_rt>, sa_mask = {__val = {4096, 140737159882048, 22425832,
              140737159882976, 5737169, 140736884375584, 140736884375672, 0, 140736946012096, 120, 140737306651560, 36, 128, 140736884375584, 133, 140736946012224}}}
#1  0x00007ffff526eb49 in __bsd_signal (sig=-328473600, handler=<value optimized out>) at ../sysdeps/posix/signal.c:49
        act = {__sigaction_handler = {sa_handler = 0x1, sa_sigaction = 0x1}, sa_mask = {__val = {4096, 0 <repeats 15 times>}}, sa_flags = 268435456,
---Type <return> to continue, or q <return> to quit---
          sa_restorer = 0x15630e8}
        oact = {__sigaction_handler = {sa_handler = 0x7ffff478e930 <gdk_io_destroy>, sa_sigaction = 0x7ffff478e930 <gdk_io_destroy>}, sa_mask = {__val = {
              140737294952752, 0, 140737306653582, 140737055919760, 13008592, 0, 140737055919760, 140737266519648, 43696720, 0, 140737263762544, 140737055919664,
              13008385, 1798918, 1798918, 140737294952784}}, sa_flags = 5724141, sa_restorer = 0x7fffec6be7b0}
#2  0x00007ffff63c3d45 in GSocket::Send_Stream (this=0x293d520, buffer=0x7fffdc3be670 "\234\016\b\204\256\004", size=6) at ./src/unix/gsocket.cpp:1684
        old_handler = 0x7fffec6be7b0
        ret = 0
#3  0x00007ffff63c2eae in GSocket::Write (this=0x293d520, buffer=0x7fffdc3be670 "\234\016\b\204\256\004", size=6) at ./src/unix/gsocket.cpp:1233
        ret = 0
        __PRETTY_FUNCTION__ = "int GSocket::Write(const char*, int)"
#4  0x00007ffff63bcfa5 in wxSocketBase::_Write (this=0x2713e70, buffer=0x7fffdc3be670, nbytes=6) at ./src/common/socket.cpp:539
        total = 0
        ret = -1
#5  0x00007ffff63bcedd in wxSocketBase::Write (this=0x2713e70, buffer=0x7fffdc3be670, nbytes=6) at ./src/common/socket.cpp:507
No locales.
#6  0x00000000006814ee in CSocketClientProxy::Write (this=0x2713e70, buffer=0x7fffdc3be670, nbytes=6) at Proxy.cpp:1309
        lock = {m_isOk = true, m_mutex = @0x2713fb8}
#7  0x00000000004e3718 in CEncryptedStreamSocket::Write (this=0x2713e70, lpBuf=0x7fffdc3be670, nBufLen=6) at EncryptedStreamSocket.cpp:210
        __FUNCTION__ = "Write"
#8  0x00000000004e08a2 in CEMSocket::Send (this=0x2713e70, maxNumberOfBytesToSend=<value optimized out>, minFragSize=<value optimized out>,
    onlyAllowedToSendControlPacket=<value optimized out>) at EMSocket.cpp:577
        tosend = 6
        result = <value optimized out>
        bWasLongTimeSinceSend = false
        sentControlPacketBytesThisCall = 0
        __FUNCTION__ = "Send"
        lock = {m_isOk = true, m_mutex = @0x2714328}
        anErrorHasOccured = false
        sentStandardPacketBytesThisCall = 0
#9  0x0000000000499382 in CEMSocket::SendControlData (this=0xd, maxNumberOfBytesToSend=3966493520, minFragSize=3966493360) at EMSocket.h:69
No locales.
#10 0x000000000048dbfb in CClientTCPSocket::SendControlData (this=0xd, maxNumberOfBytesToSend=3966493520, overchargeMaxBytesToSend=3966493360)
    at ClientTCPSocket.cpp:2124
        returnStatus = {success = 192, sentBytesStandardPackets = 32767, sentBytesControlPackets = 3828357696}
#11 0x00000000005741f4 in UploadBandwidthThrottler::Entry (this=<value optimized out>) at UploadBandwidthThrottler.cpp:401
        socketSentBytes = {success = false, sentBytesStandardPackets = 0, sentBytesControlPackets = 0}
        socket = 0x2714290
        slots = <value optimized out>
        spentBytes = 0
        spentOverhead = <value optimized out>
        sendLock = {m_isOk = true, m_mutex = @0x1563070}
        timeSinceLastLoop = <value optimized out>
        minFragSize = 1300
        doubleSendSize = 2600
        sleepTime = <value optimized out>
        thisLoopTick = 1914991441
        bytesToSpend = <value optimized out>
        extraSleepTime = 1
        step = 46
        lastLoopTick = 0
        allowedDataRate = <value optimized out>
        rememberedSlotCounter = 2
        sendLock = {m_isOk = false, m_mutex = @0x7fffffffdb30}
#12 0x00007ffff60dc705 in wxThreadInternal::PthreadStart (thread=0x1563050) at ./src/unix/threadpsx.cpp:766
        __clframe = {__cancel_routine = 0x7ffff60dc84f <wxPthreadCleanup(void*)>, __cancel_arg = 0x1563050, __do_it = 1, __cancel_type = 0}
        pthread = 0x152a740
        rc = 0
        dontRunAtAll = false
        __FUNCTION__ = "PthreadStart"
#13 0x00007ffff60dc5a5 in wxPthreadStart (ptr=0x1563050) at ./src/unix/threadpsx.cpp:718
No locales.
---Type <return> to continue, or q <return> to quit---
#14 0x00007ffff7bc6971 in start_thread (arg=<value optimized out>) at pthread_create.c:304
        __res = <value optimized out>
        pd = 0x7fffec6bf700
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140737159886592, 2056249433585625392, 140737488345904, 140737159887296, 140737354125376, 3, -2056285613887837904,
                -2056266445640685264}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <value optimized out>
        robust = <value optimized out>
        freesize = <value optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#15 0x00007ffff532192d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
No locales.
#16 0x0000000000000000 in ?? ()
No symbol table info available.

Hilo 1 (Thread 0x7ffff7fb4940 (LWP 9635)):
#0  __pthread_mutex_lock (mutex=0x7) at pthread_mutex_lock.c:50
        __PRETTY_FUNCTION__ = "__pthread_mutex_lock"
        type = <value optimized out>
#1  0x00007ffff29d004f in g_source_destroy_internal (source=0x7fffe6398db0, context=0xffffffffffffffff, have_lock=0) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:942
No locales.
#2  0x00007ffff29d290e in g_source_remove (tag=<value optimized out>) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:1717
        source = <value optimized out>
        __PRETTY_FUNCTION__ = "g_source_remove"
#3  0x00007ffff67fcc7d in GSocketGUIFunctionsTableConcrete::Uninstall_Callback (this=0x7ffff6ccabb0, socket=0x2b2eda0, event=GSOCK_OUTPUT) at ./src/gtk/gsockgtk.cpp:119
        m_id = 0x27c6d00
        c = 1
        __PRETTY_FUNCTION__ = "virtual void GSocketGUIFunctionsTableConcrete::Uninstall_Callback(GSocket*, GSocketEvent)"
#4  0x00007ffff63c37ef in GSocket::Disable (this=0x2b2eda0, event=GSOCK_OUTPUT) at ./src/unix/gsocket.cpp:1527
No locales.
#5  0x00007ffff63c42f8 in GSocket::Detected_Write (this=0x2b2eda0) at ./src/unix/gsocket.cpp:1836
No locales.
#6  0x00007ffff67fca1c in _GSocket_GDK_Input (data=0x2b2eda0, source=82, condition=GDK_INPUT_WRITE) at ./src/gtk/gsockgtk.cpp:41
        socket = 0x2b2eda0
#7  0x00007ffff478e99f in gdk_io_invoke (source=<value optimized out>, condition=<value optimized out>, data=<value optimized out>)
    at /build/buildd/gtk+2.0-2.22.0/gdk/gdkevents.c:1082
        closure = 0x7fffe40f0fb0
        gdk_cond = GDK_INPUT_WRITE
#8  0x00007ffff29d0342 in g_main_dispatch (context=0xc67ed0) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2149
        dispatch = 0x7ffff2a14a90 <g_io_unix_dispatch>
        user_data = 0x7fffe40f0fb0
        callback = 0x7ffff478e950 <gdk_io_invoke>
        cb_funcs = 0x7ffff2c70610
        cb_data = 0x7fffe40fe170
        current_source_link = {data = 0x7fffe61c4170, next = 0x0}
        source = 0x7fffe61c4170
        current = 0x1771950
        i = 45
#9  g_main_context_dispatch (context=0xc67ed0) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2702
No locales.
#10 0x00007ffff29d42a8 in g_main_context_iterate (context=0xc67ed0, block=<value optimized out>, dispatch=<value optimized out>, self=<value optimized out>)
    at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2780
        max_priority = 300
        timeout = 0
        some_ready = 1
        nfds = 99
        allocated_nfds = -159537912
        fds = <value optimized out>
        __PRETTY_FUNCTION__ = "g_main_context_iterate"
#11 0x00007ffff29d47b5 in g_main_loop_run (loop=0x1cb17a0) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2988
        self = 0xc67870
        __PRETTY_FUNCTION__ = "g_main_loop_run"
---Type <return> to continue, or q <return> to quit---
#12 0x00007ffff4b4d3e7 in IA__gtk_main () at /build/buildd/gtk+2.0-2.22.0/gtk/gtkmain.c:1237
        tmp_list = 0x16be450
        functions = 0x0
        init = 0x7fffffffdfd0
        loop = <value optimized out>
#13 0x00007ffff67faa5f in wxEventLoop::Run (this=0x1c9ca80) at ./src/gtk/evtloop.cpp:76
        __FUNCTION__ = "Run"
        activate = {m_evtLoopOld = 0x0}
        exitcode = 32767
#14 0x00007ffff6896cc8 in wxAppBase::MainLoop (this=0xc67930) at ./src/common/appcmn.cpp:312
        mainLoop = {<wxEventLoopPtr> = {m_ptr = 0x1c9ca80}, m_pp = 0xc679a8, m_pOld = 0x0}
#15 0x00007ffff6896e42 in wxAppBase::OnRun (this=0xc67930) at ./src/common/appcmn.cpp:367
No locales.
#16 0x00007ffff606ae5b in wxEntry (argc=@0x7ffff638f4b0, argv=0xc56dd0) at ./src/common/init.cpp:448
        callOnExit = {<No data fields>}
        initializer = {m_ok = true}
#17 0x00007ffff606af31 in wxEntry (argc=@0x7fffffffe0bc, argv=0x7fffffffe1a8) at ./src/common/init.cpp:460
No locales.
#18 0x00000000005d04c2 in main (argc=1, argv=0x1) at amule-gui.cpp:93
No locales.

Logged

btkaos

  • Global Moderator
  • Sr. Member
  • *****
  • Karma: 110
  • Offline Offline
  • Posts: 486
  • Kaos is infinite!
Re: upredictable memory leak
« Reply #34 on: January 11, 2011, 12:22:07 AM »

Another crash, same pattern, as soon as TCQF reached 800 it got a sigsev/sigabort.

Now switching to self-build amule using stock wx. I'm running amule inside gdb, next try will be running it without and watching the logger.
Logged

btkaos

  • Global Moderator
  • Sr. Member
  • *****
  • Karma: 110
  • Offline Offline
  • Posts: 486
  • Kaos is infinite!
Re: upredictable memory leak
« Reply #35 on: January 11, 2011, 12:45:52 AM »

Hey, switching builds had the effect, I'm getting an OOM now! Same situation as before but with Ubuntu stock WX.

Code: [Select]
2011-01-11 00:33:50: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 0 TCQF 0 SO 16 EMS 232
 2011-01-11 00:33:54: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 0 TCQF 0 SO 16 EMS 231
 2011-01-11 00:33:58: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 1 TCQF 0 SO 16 EMS 231
 2011-01-11 00:34:01: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 0 TCQF 0 SO 16 EMS 219
 2011-01-11 00:34:04: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 0 TCQF 0 SO 16 EMS 241
 2011-01-11 00:34:08: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 4 CQF 0 TCQ 0 TCQF 0 SO 16 EMS 245
 2011-01-11 00:34:12: UploadBandwidthThrottler.cpp(311): UBT: t 1 CQ 5 CQF 0 TCQ 1 TCQF 0 SO 16 EMS 244
 2011-01-11 00:34:16: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 0 TCQF 0 SO 16 EMS 243
 2011-01-11 00:34:19: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 4 CQF 0 TCQ 1 TCQF 0 SO 16 EMS 243
 2011-01-11 00:34:22: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 14 CQF 0 TCQ 0 TCQF 0 SO 16 EMS 258
 2011-01-11 00:34:25: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 0 TCQF 0 SO 16 EMS 263
 2011-01-11 00:34:29: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 2 CQF 0 TCQ 0 TCQF 0 SO 16 EMS 262
 2011-01-11 00:34:41: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 5 TCQF 0 SO 16 EMS 257
 2011-01-11 00:34:41: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 5 TCQF 0 SO 16 EMS 257
 2011-01-11 00:34:41: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 5 TCQF 0 SO 16 EMS 257
 2011-01-11 00:34:43: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 10 TCQF 0 SO 16 EMS 232
 2011-01-11 00:34:46: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 0 TCQF 0 SO 16 EMS 232
 2011-01-11 00:34:49: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 0 TCQF 0 SO 16 EMS 236
 2011-01-11 00:34:53: UploadBandwidthThrottler.cpp(311): UBT: t 0 CQ 0 CQF 0 TCQ 0 TCQF 28 SO 16 EMS 220
 2011-01-11 00:34:56: UploadBandwidthThrottler.cpp(311): UBT: t 2 CQ 0 CQF 0 TCQ 0 TCQF 95 SO 16 EMS 239
Umm, we see a pattern with TCQF here, but no so much as before and aMule is eating 2Gb of memory. Anyways, it seems if TCQF increases, something bad is bound to happen.

Now I have amule interrupted eating 2Gb of memory, I mean I may operate in GDB with it. The backtrace is the same as previous OOM.

Code: [Select]
(gdb) bt
#0  0x00007ffff7bc9c9d in __pthread_mutex_unlock_usercnt (mutex=0xc3d840) at pthread_mutex_unlock.c:52
#1  __pthread_mutex_unlock (mutex=0xc3d840) at pthread_mutex_unlock.c:290
#2  0x00007ffff6201066 in wxMutexInternal::Unlock (this=0xc3d840) at ../src/unix/threadpsx.cpp:297
#3  0x00007ffff64ada84 in wxSocketBase::OnRequest (this=0x20e2ba0, notification=wxSOCKET_OUTPUT) at ../src/common/socket.cpp:1006
#4  0x00007ffff64b242e in GSocket::Detected_Write (this=0x1fc6610) at ../src/unix/gsocket.cpp:1836
#5  0x00007ffff490199f in gdk_io_invoke (source=<value optimized out>, condition=<value optimized out>, data=<value optimized out>)
    at /build/buildd/gtk+2.0-2.22.0/gdk/gdkevents.c:1082
#6  0x00007ffff2d6a342 in g_main_dispatch (context=0xc68820) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2149
#7  g_main_context_dispatch (context=0xc68820) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2702
#8  0x00007ffff2d6e2a8 in g_main_context_iterate (context=0xc68820, block=<value optimized out>, dispatch=<value optimized out>, self=<value optimized out>)
    at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2780
#9  0x00007ffff2d6e7b5 in g_main_loop_run (loop=0x1c9ade0) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2988
#10 0x00007ffff4cc03e7 in IA__gtk_main () at /build/buildd/gtk+2.0-2.22.0/gtk/gtkmain.c:1237
#11 0x00007ffff6893a28 in wxEventLoop::Run (this=0x1c8e2a0) at ../src/gtk/evtloop.cpp:76
#12 0x00007ffff6923f18 in wxAppBase::MainLoop (this=0xc68280) at ../src/common/appcmn.cpp:312
#13 0x00007ffff619d025 in wxEntry (argc=<value optimized out>, argv=<value optimized out>) at ../src/common/init.cpp:448
#14 0x00000000005d0ae2 in main (argc=1, argv=0x0) at amule-gui.cpp:93
OnRequest, my friend. Running it a little more (until it eats some more memory) shows our friend

Code: [Select]
(gdb) bt
#0  _int_malloc (av=0x7ffff572ce40, bytes=48) at malloc.c:4709
#1  0x00007ffff542a38e in __libc_malloc (bytes=48) at malloc.c:3660
#2  0x00007ffff5c83ded in operator new(unsigned long) () from /usr/lib/libstdc++.so.6
#3  0x00007ffff6195cdb in wxObjectList::CreateNode (this=0x7fffe40010b0, prev=0x3, next=0x0, data=0x77537030, key=...) at ../include/wx/list.h:1185
#4  0x00007ffff61a9001 in wxListBase::Append (this=0x7fffe40010b0, object=0x77537030) at ../src/common/list.cpp:244
#5  0x00007ffff620466d in Append (this=0xc1e500, event=<value optimized out>) at ../include/wx/list.h:1185
#6  wxEvtHandler::AddPendingEvent (this=0xc1e500, event=<value optimized out>) at ../src/common/event.cpp:1156
#7  0x00007ffff64ada84 in wxSocketBase::OnRequest (this=0x20e2ba0, notification=wxSOCKET_OUTPUT) at ../src/common/socket.cpp:1006
#8  0x00007ffff64b242e in GSocket::Detected_Write (this=0x1fc6610) at ../src/unix/gsocket.cpp:1836
#9  0x00007ffff490199f in gdk_io_invoke (source=<value optimized out>, condition=<value optimized out>, data=<value optimized out>)
    at /build/buildd/gtk+2.0-2.22.0/gdk/gdkevents.c:1082
#10 0x00007ffff2d6a342 in g_main_dispatch (context=0xc68820) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2149
#11 g_main_context_dispatch (context=0xc68820) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2702
#12 0x00007ffff2d6e2a8 in g_main_context_iterate (context=0xc68820, block=<value optimized out>, dispatch=<value optimized out>, self=<value optimized out>)
    at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2780
#13 0x00007ffff2d6e7b5 in g_main_loop_run (loop=0x1c9ade0) at /build/buildd/glib2.0-2.26.1/glib/gmain.c:2988
#14 0x00007ffff4cc03e7 in IA__gtk_main () at /build/buildd/gtk+2.0-2.22.0/gtk/gtkmain.c:1237
#15 0x00007ffff6893a28 in wxEventLoop::Run (this=0x1c8e2a0) at ../src/gtk/evtloop.cpp:76
#16 0x00007ffff6923f18 in wxAppBase::MainLoop (this=0xc68280) at ../src/common/appcmn.cpp:312
#17 0x00007ffff619d025 in wxEntry (argc=<value optimized out>, argv=<value optimized out>) at ../src/common/init.cpp:448
#18 0x00000000005d0ae2 in main (argc=1, argv=0x3) at amule-gui.cpp:93
So we are adding a lot of events which cannot be served. This is why I'm againts of event based programming for everything.

And we finally end with a SIGSEGV :) nice and complete pack. The backtrace is identical to the previous one.

A wild guess, could the sockets or connections expire somehow in the queue and cause the SIGSEGV. I'm saying this because I find a correlation among the amount of time I stop amule inside a gdb and the crash happening. If I don't wait time, amule keeps eating memory and doesn't crash. Maybe some debug message for when a socket is deleted by timeout could be useful.

Well, I guess is hard to find something new, I'll study the code and play with debug options.

Regards,
BTK
Logged

btkaos

  • Global Moderator
  • Sr. Member
  • *****
  • Karma: 110
  • Offline Offline
  • Posts: 486
  • Kaos is infinite!
Re: upredictable memory leak
« Reply #36 on: January 12, 2011, 03:30:06 PM »

Using svn wx -> the crash persists.

I did some malloc debugging and my guess is that the sockets get thousand of pending events, I'll have a closer look.
Logged

btkaos

  • Global Moderator
  • Sr. Member
  • *****
  • Karma: 110
  • Offline Offline
  • Posts: 486
  • Kaos is infinite!
Re: upredictable memory leak
« Reply #37 on: January 12, 2011, 04:06:23 PM »

Indeed, with wx svn amule's behaviour is much worse, I'll try with a previous known wx version, something is wrong in the socket handling. (Well, everything, there's a reason no one uses event-based programming for sockets and networds, but poll and queues, and trying to cast epoll into events, uff, not a good idea.)
Logged

btkaos

  • Global Moderator
  • Sr. Member
  • *****
  • Karma: 110
  • Offline Offline
  • Posts: 486
  • Kaos is infinite!
Re: upredictable memory leak
« Reply #38 on: January 12, 2011, 08:16:31 PM »

I did modify wx and amule in order to confirm my suspitions on where the memory is spent. Indeed I confirmed that memory is exhausted allocating new events like crazy for EMSockets.

I did modify STU patch in order to see total events for sockets (TEVS), see:
Code: [Select]
2011-01-12 20:01:12: UploadBandwidthThrottler.cpp(326): UBT: t 0 CQ 0 CQF 0 TCQ 1 TCQF 63 SO 16 EMS 226 LEMS 226 TEVS 0
 2011-01-12 20:01:16: UploadBandwidthThrottler.cpp(326): UBT: t 2 CQ 14 CQF 0 TCQ 1 TCQF 128 SO 16 EMS 237 LEMS 237 TEVS 0
 2011-01-12 20:01:19: UploadBandwidthThrottler.cpp(326): UBT: t 3 CQ 0 CQF 0 TCQ 1 TCQF 196 SO 16 EMS 229 LEMS 229 TEVS 0
 2011-01-12 20:01:23: UploadBandwidthThrottler.cpp(326): UBT: t 4 CQ 0 CQF 0 TCQ 2 TCQF 277 SO 16 EMS 224 LEMS 224 TEVS 0
 2011-01-12 20:01:27: UploadBandwidthThrottler.cpp(326): UBT: t 3 CQ 0 CQF 0 TCQ 2 TCQF 350 SO 16 EMS 224 LEMS 224 TEVS 0
 2011-01-12 20:01:35: UploadBandwidthThrottler.cpp(326): UBT: t 5 CQ 0 CQF 0 TCQ 3 TCQF 376 SO 16 EMS 230 LEMS 230 TEVS 0
 2011-01-12 20:01:35: UploadBandwidthThrottler.cpp(326): UBT: t 7 CQ 0 CQF 0 TCQ 3 TCQF 376 SO 16 EMS 230 LEMS 230 TEVS 0
 2011-01-12 20:01:38: UploadBandwidthThrottler.cpp(326): UBT: t 6 CQ 0 CQF 0 TCQ 0 TCQF 447 SO 16 EMS 231 LEMS 231 TEVS 230
 2011-01-12 20:13:25: UploadBandwidthThrottler.cpp(326): UBT: t 8 CQ 0 CQF 0 TCQ 0 TCQF 455 SO 16 EMS 231 LEMS 231 TEVS 45217650
 2011-01-12 20:13:25: UploadBandwidthThrottler.cpp(326): UBT: t 7 CQ 0 CQF 0 TCQ 0 TCQF 455 SO 16 EMS 231 LEMS 231 TEVS 187067970
At this point I did stop amule, it was eating some 2Gb of RAM. See that we have more than 187 million events pending for 231 sockets. Not good. I guess a good understanding of wxSocketClient and friends is needed in order to avoid this.

Unfortunately I don't understand yet the complex handing of amule download limits so I cannot help more, but I'll try.

I did patch wx and amule, it you are interested say so and I'll post it.
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: upredictable memory leak
« Reply #39 on: January 12, 2011, 10:54:28 PM »

Indeed, with wx svn amule's behaviour is much worse, I'll try with a previous known wx version, something is wrong in the socket handling.
Last time I tried wx SVN it even failed in Windows, where it worked before (better than in Linux at least). Kad was firewalled. Who knows what they screwed up again. Problem is we are probably the only wx app in existance using network in such a way.

Unfortunately I don't understand yet the complex handing of amule download limits so I cannot help more, but I'll try.
Welcome to the club.  :(
The whole EMSocket stuff is nightmarish. Lot of verbatim eMule code, but with some deviations (which aren't explained). Virtual functions, several layers for crypto and proxy (is anybody using proxy?!?), and so on. I did fix the download limit function some time ago (because it was off roundly by factor two), but only had to fix a calculation, not go through the whole path.

Anyway, thanks to your work we have made a big progress from "runs out of memory" where we were some days before. We'll just keep beating it till it's dead.  :)
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

btkaos

  • Global Moderator
  • Sr. Member
  • *****
  • Karma: 110
  • Offline Offline
  • Posts: 486
  • Kaos is infinite!
Re: upredictable memory leak
« Reply #40 on: January 13, 2011, 01:59:42 AM »

Well for one forcing sockets to process all their pending events or disabling download in that cases could help. Unfortunately the event stuff is private to wxEvtHandler and wxSocket, so having a fine grain control over events is not possible in aMule.

Anyways we have a hint, sockets eat all available memory in pending events, and given that we (aMule) have no control whatsoever over events, we could make a case to wx developers in the sense that the library and event handling code shouldn't allow this to happen.

Regards,
BTK
Logged

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: Re: upredictable memory leak
« Reply #41 on: January 13, 2011, 04:15:51 AM »

Sounds like a job for... me?
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: upredictable memory leak
« Reply #42 on: January 13, 2011, 07:15:03 PM »

Well, I'd very much like to see you showing off and fixing the bug with a "duh, I have to pamper everybody here".  :)
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

btkaos

  • Global Moderator
  • Sr. Member
  • *****
  • Karma: 110
  • Offline Offline
  • Posts: 486
  • Kaos is infinite!
Re: upredictable memory leak
« Reply #43 on: January 13, 2011, 11:05:33 PM »

Well, the obvious suspects to investigate are CEMSocket::OnReceive and specially CEMSocket::SetDownloadLimit.
Logged

btkaos

  • Global Moderator
  • Sr. Member
  • *****
  • Karma: 110
  • Offline Offline
  • Posts: 486
  • Kaos is infinite!
Re: upredictable memory leak
« Reply #44 on: January 14, 2011, 09:45:32 PM »

My guess at what's going on:

Lets revisit how wx/glib work with sockets. When we create a CEMSocket, wx adds it to the list of glib's sockets to check. (see GSocketGUIFunctionsTableConcrete::Install_Callback). Modulo error handling, the callback calls Detected_{Read,Write}, functions which perform some basic error handling and call the callback. socket.cpp establishes an unique event handler (see wxSocketBase::OnRequest), which then checks the settable mask for event in wxSocketClient and proceeds to create the appropriate wx events unless they are masked.

Creating an event in wx is just appending it to a list, so nothing special happens here. Well, we have seen half the story, so glib is detecting that a socket is receiving data and wx is adding events to a list, causing an OOM condition. We must understand now why the created events are not served.

wx processes events using glib's idle handling. This means that the wx event handler will only run if glib runs its idle handlers. This means that no more events should be happening. I have checked that when amule starts eating all the available memory and no wx event handling is taking place, so what is causing the idle handler to not be run?

Indeed, in glib's main loop, sockets are checked for new data. If some socket has new data the above sequence will happen, which is pretty cpu intensive, as it must create a new event, (must call new, etc...). As soon as the rate of new data is great enough to use 100% CPU, boom!! wx event handling will not take place and pending events will eat all the available memory.

What has this to do with disabling the download limit helping the crash not to occur. Well, a lot. If we read from some socket but we don't eat all the available data, a new event will be generated by wx, kind of a spurious event given that a new event will be generated indicating there's data remaining. Ideally we'd like to have events only in the case new data was actually received. If we disable the limit, amule will read as much data as possible and indeed we'll get only "real" events when new network data arrives. Picture this, if we have 1000 bytes waiting in the socket's buffer and we read 1 byte each time, we will have to process 1000 events, although no new data arrived.

Umm, that's ugly, but what could be the fix? IMHO the only way to stop this behaviour is to force CEMSocket to mask socket events when it knows that there's more data in the buffer. This will fix the OOM, and wx event handling starvation should require much higher load.


Summary: Every time we don't read in full a socket buffer or new data arrives from network a new wx event is created. Download limit makes partial reads a frequent case. When the socket event handling manages to eat 100% CPU we can't process the wx events, so amule dies in OOM creating millions of unprocessable events.


This is my view, of course I'm not expert in glib/wx so take all my finding with a grain of salt, I could have missed something important. I'll keep working on that, I want to think more about the issue before writing a patch, of course ideas and comments are appreciated :) Don't hesitate to request for more information in case some of my writing is not clear.

Regards,
BTK



Logged
Pages: 1 2 [3] 4 5 ... 8