aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: 20041212 - end-less loop in main amule thread  (Read 2512 times)

wizeman

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 6
    • http://www.wizy.org
20041212 - end-less loop in main amule thread
« on: December 13, 2004, 08:02:39 AM »

I'm using wxWidgets 2.5.3 w/ GTK2 without unicode on Gentoo AMD64.

aMule was running in normal (GUI) mode, and amuleweb was also running.

After an hour or two, the amule process started consuming 100% cpu, but the GUI was fully functional and downloads didn't stop. I pressed ctrl-c in gdb and got this stack trace:

Code: [Select]
bt full:

#0  0x0000002a95d6ab35 in wxCommandEvent::wxCommandEvent(int, int) () from /usr/lib/libwx_gtk2_core-2.5.so.3
No symbol table info available.
#1  0x0000002a95e5fce5 in wxWindowBase::UpdateWindowUI(long) () from /usr/lib/libwx_gtk2_core-2.5.so.3
No symbol table info available.
#2  0x0000002a95da0d1d in wxWindow::OnInternalIdle() () from /usr/lib/libwx_gtk2_core-2.5.so.3
No symbol table info available.
#3  0x0000002a95dff0f1 in wxAppBase::SendIdleEvents(wxWindow*, wxIdleEvent&) () from /usr/lib/libwx_gtk2_core-2.5.so.3
No symbol table info available.
#4  0x0000002a95dff117 in wxAppBase::SendIdleEvents(wxWindow*, wxIdleEvent&) () from /usr/lib/libwx_gtk2_core-2.5.so.3
No symbol table info available.
#5  0x0000002a95dff117 in wxAppBase::SendIdleEvents(wxWindow*, wxIdleEvent&) () from /usr/lib/libwx_gtk2_core-2.5.so.3
No symbol table info available.
#6  0x0000002a95dff117 in wxAppBase::SendIdleEvents(wxWindow*, wxIdleEvent&) () from /usr/lib/libwx_gtk2_core-2.5.so.3
No symbol table info available.
#7  0x0000002a95dff117 in wxAppBase::SendIdleEvents(wxWindow*, wxIdleEvent&) () from /usr/lib/libwx_gtk2_core-2.5.so.3
No symbol table info available.
#8  0x0000002a95dff117 in wxAppBase::SendIdleEvents(wxWindow*, wxIdleEvent&) () from /usr/lib/libwx_gtk2_core-2.5.so.3
No symbol table info available.
#9  0x0000002a95dff117 in wxAppBase::SendIdleEvents(wxWindow*, wxIdleEvent&) () from /usr/lib/libwx_gtk2_core-2.5.so.3
No symbol table info available.
#10 0x0000002a95dff02c in wxAppBase::ProcessIdle() () from /usr/lib/libwx_gtk2_core-2.5.so.3
No symbol table info available.
#11 0x0000002a95d7833b in wxApp::Yield(bool) () from /usr/lib/libwx_gtk2_core-2.5.so.3
No symbol table info available.
#12 0x0000002a963283dd in wxYield() () from /usr/lib/libwx_base-2.5.so.3
No symbol table info available.
#13 0x0000002a96162516 in wxSocketBase::_Wait(long, long, int) () from /usr/lib/libwx_base_net-2.5.so.3
No symbol table info available.
#14 0x0000002a9616288f in wxSocketBase::WaitForRead(long, long) () from /usr/lib/libwx_base_net-2.5.so.3
No symbol table info available.
#15 0x0000002a96162906 in wxSocketBase::_Read(void*, unsigned) () from /usr/lib/libwx_base_net-2.5.so.3
No symbol table info available.
#16 0x0000002a96162ccc in wxSocketBase::Read(void*, unsigned) () from /usr/lib/libwx_base_net-2.5.so.3
No symbol table info available.
#17 0x000000000058efc3 in ECSocket::ReadBuffer(wxSocketBase*, void*, unsigned) (this=0xf1ae40, sock=0x22f5b60,
    buffer=0x2a99f71010, len=16777216) at ECSocket.cpp:136
        msgRemain = 16777216
        LastIO = 0
        iobuf = 0x2a99f71010 "\023QUEUE UL_GETLENGTH"
        error = false
#18 0x0000000000590b29 in CECTag (this=0x36a4460, sock=0x22f5b60, socket=@0xf1ae40) at ECPacket.cpp:408
        tagLen = 16777216
        tmp_tagName = 256
#19 0x0000000000590d39 in CECTag::ReadChildren(wxSocketBase*, ECSocket&) (this=0x111a040, sock=0x22f5b60, socket=@0xf1ae40)
    at ECPacket.cpp:455
        i = 0
        tmp_tagCount = 65280
#20 0x00000000005911f6 in CECPacket (this=0x111a040, sock=0x22f5b60, socket=@0xf1ae40) at ECPacket.cpp:652
No locals.
#21 0x000000000058f33b in ECSocket::ReadPacket(wxSocketBase*) (this=0xf1ae40, sock=0x22f5b60) at ECSocket.cpp:251
        flags = 32
        p = (CECPacket *) 0x18ca240
#22 0x0000000000594fe0 in ExternalConn::OnSocketEvent(wxSocketEvent&) (this=0xf1aed0, event=@0x18ca240) at ExternalConn.cpp:159
        sock = (struct wxSocketBase *) 0x22f5b60
        request = (CECPacket *) 0x0
        response = (CECPacket *) 0x0
#23 0x0000002a962b7599 in wxAppConsole::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const ()
   from /usr/lib/libwx_base-2.5.so.3
No symbol table info available.
#24 0x0000002a96325382 in wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) ()
   from /usr/lib/libwx_base-2.5.so.3
No symbol table info available.
#25 0x0000002a96325693 in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () from /usr/lib/libwx_base-2.5.so.3
No symbol table info available.
#26 0x0000002a96326217 in wxEvtHandler::ProcessEvent(wxEvent&) () from /usr/lib/libwx_base-2.5.so.3
No symbol table info available.
#27 0x0000002a9632606b in wxEvtHandler::ProcessPendingEvents() () from /usr/lib/libwx_base-2.5.so.3
No symbol table info available.
#28 0x0000002a962b752e in wxAppConsole::ProcessPendingEvents() () from /usr/lib/libwx_base-2.5.so.3
No symbol table info available.
#29 0x0000002a95d783a4 in wxApp::Yield(bool) () from /usr/lib/libwx_gtk2_core-2.5.so.3
No symbol table info available.
#30 0x0000002a97869afe in g_child_watch_add () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#31 0x0000002a97866bc2 in g_main_depth () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#32 0x0000002a97867bf4 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#33 0x0000002a97867ede in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#34 0x0000002a9786848d in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#35 0x0000002a96c23f91 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
No symbol table info available.
#36 0x0000002a95d8f000 in wxEventLoop::Run() () from /usr/lib/libwx_gtk2_core-2.5.so.3
No symbol table info available.
#37 0x0000002a95dfed9a in wxAppBase::MainLoop() () from /usr/lib/libwx_gtk2_core-2.5.so.3
No symbol table info available.
#38 0x0000002a962e7ad7 in wxEntry(int&, char**) () from /usr/lib/libwx_base-2.5.so.3
No symbol table info available.
#39 0x00000000006a6f26 in main (argc=1, argv=0x7fbffff578) at amule-gui.cpp:300
No locals.

Notice the strange msgRemain, tagLen and tmp_tagCount values.

I issued the 'continue' command in gdb, and amule continued running normally (except it was consuming all cpu, of course) and after a few minutes it segfaulted:

Code: [Select]
bt full:

#0  0x000000000058eef9 in ECSocket::WriteNumber(wxSocketBase*, void const*, unsigned) (this=0xf1ae40, sock=0x22f5b60, buffer=0x28,
    len=1) at ECSocket.cpp:111
        tmp = "\003\000\000\000\000\000\000"
#1  0x000000000059124c in CECPacket::WritePacket(wxSocketBase*, ECSocket&) const (this=0x0, sock=0x22f5b60, socket=@0xf1ae40)
    at ECPacket.cpp:658
No locals.
#2  0x000000000058f232 in ECSocket::WritePacket(wxSocketBase*, CECPacket const*) (this=0xf1ae40, sock=0x22f5b60, packet=0x0)
    at ECSocket.cpp:199
        flags = 32 ' '
#3  0x0000000000595235 in ExternalConn::OnSocketEvent(wxSocketEvent&) (this=0xf1aed0, event=@0x18ca240) at ExternalConn.cpp:178
        sock = (struct wxSocketBase *) 0x22f5b60
        request = (CECPacket *) 0x0
        response = (CECPacket *) 0x0
#4  0x0000002a962b7599 in wxAppConsole::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const ()
   from /usr/lib/libwx_base-2.5.so.3
No symbol table info available.
#5  0x0000002a96325382 in wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) ()
   from /usr/lib/libwx_base-2.5.so.3
No symbol table info available.
#6  0x0000002a96325693 in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () from /usr/lib/libwx_base-2.5.so.3
No symbol table info available.
#7  0x0000002a96326217 in wxEvtHandler::ProcessEvent(wxEvent&) () from /usr/lib/libwx_base-2.5.so.3
No symbol table info available.
#8  0x0000002a9632606b in wxEvtHandler::ProcessPendingEvents() () from /usr/lib/libwx_base-2.5.so.3
No symbol table info available.
#9  0x0000002a962b752e in wxAppConsole::ProcessPendingEvents() () from /usr/lib/libwx_base-2.5.so.3
No symbol table info available.
#10 0x0000002a95d783a4 in wxApp::Yield(bool) () from /usr/lib/libwx_gtk2_core-2.5.so.3
No symbol table info available.
#11 0x0000002a97869afe in g_child_watch_add () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#12 0x0000002a97866bc2 in g_main_depth () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#13 0x0000002a97867bf4 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#14 0x0000002a97867ede in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#15 0x0000002a9786848d in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#16 0x0000002a96c23f91 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
No symbol table info available.
#17 0x0000002a95d8f000 in wxEventLoop::Run() () from /usr/lib/libwx_gtk2_core-2.5.so.3
No symbol table info available.
#18 0x0000002a95dfed9a in wxAppBase::MainLoop() () from /usr/lib/libwx_gtk2_core-2.5.so.3
No symbol table info available.
#19 0x0000002a962e7ad7 in wxEntry(int&, char**) () from /usr/lib/libwx_base-2.5.so.3
No symbol table info available.
#20 0x00000000006a6f26 in main (argc=1, argv=0x7fbffff578) at amule-gui.cpp:300

This isn't the first time this has happened, and I think it can be reproduced by refreshing the transfer list web page lots of times, but I didn't have time to test this.

I will try to debug a little further next time ;)
« Last Edit: December 13, 2004, 08:10:58 AM by wizeman »
Logged

lfroen

  • Guest
Re: 20041212 - end-less loop in main amule thread
« Reply #1 on: December 13, 2004, 09:56:40 AM »

The problem is using WaitForRead in gui code. This is what causing 100% cpu. For some reason, EC thinks that must be more data coming, but it doesn't. So, EC is running in internal wx loop, repeatedly calling idle handler.
Reason for this is bug in EC.


Quote
ReadBuffer(wxSocketBase*, void*, unsigned) (this=0xf1ae40, sock=0x22f5b60,
    buffer=0x2a99f71010, len=16777216) at ECSocket.cpp:136
        msgRemain = 16777216
        LastIO = 0
        iobuf = 0x2a99f71010 "\023QUEUE UL_GETLENGTH"
        error = false

Since code in question belongs to old EC, I would not pay match attention. This code will be replaced soon with corresponding ECv2 version, which looks match more prone so such errors.
Logged

wizeman

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 6
    • http://www.wizy.org
Re: 20041212 - end-less loop in main amule thread
« Reply #2 on: December 13, 2004, 08:46:06 PM »

Thanks

This seems to be the only bug that is preventing me to use amule for more than a few hours without crashing, with current CVS. There's also a SIGSEGV in amuleweb every now and then, but that can be debugged later.

It happened again with today's CVS, leaving the same trace, but with different values in the local variables. I'll try to see what I can do.. :)
« Last Edit: December 13, 2004, 08:48:30 PM by wizeman »
Logged