aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: amule 2.2.2 crashing in Ubuntu 8.04 x86_64  (Read 3616 times)

QuarkOfNature

  • Newbie
  • Karma: 0
  • Offline Offline
  • Posts: 1
amule 2.2.2 crashing in Ubuntu 8.04 x86_64
« on: October 18, 2008, 09:46:47 PM »

I've been having problems with amule crashing on my Ubuntu 8.04 x86_64 box, both the version that is in the official repositories (2.2.1), and the latest/greatest stable version (2.2.2), compiled from source myself.  Sometimes it'll go days without crashing, and sometimes only minutes.  I don't have statistics to back it up, by my observation is that it seems to trend fairly steadily where it crashes more frequently when there are more items in the download list.  Dunno.

Anway, I've seen a number of people posting about similar problems, both here and on the ubuntu forums, but I haven't seen any definitive solutions, and I haven't seen a trace posted here on this issue so far that seems to meet with approval as being sufficiently useful/detailed.  So, I figured I'd give it a try and see if it helps...

I built amule 2.2.2 using the configure line: "./configure --enable-debug --disable-optimize", here was the tail end of the output:

Code: [Select]
  Configured aMule 2.2.2 for 'x86_64-unknown-linux-gnu'.

  aMule enabled options:

  **** aMule Core ****
  Prefix where aMule should be installed?                    /usr/local
  Should aMule be compiled with i18n support?                yes
  Should aMule be compiled in debug mode?                    yes
  Should aMule be compiled with profiling?                   no
  Should aMule be compiled with optimizations?               no
  Should aMule be compiled with UPnP support?                disabled
  Should aMule be compiled with IP2country support?          no
  Should aMule monolithic application be built?              yes
  Should aMule daemon version be built?                      no
  Should aMule remote gui be built? (EXPERIMENTAL)           no
  Crypto++ library/headers style?                            installed

  **** aMule TextClient ****
  Should aMule Command Line Client be built?                 no

  **** aMule WebServer ****
  Should aMule WebServer be built?                           no

  **** aMule ED2K Links Handler ****
  Should aMule ED2K Links Handler be built?                  yes

  **** aMuleLinkCreator ****
  Should aMuleLinkCreator GUI version (alc) be built?        no
  Should aMuleLinkCreator for console (alcc) be built?       no

  **** aMule Statistics ****
  Should C aMule Statistics (CAS) be built?                  no
  Should aMule GUI Statistics (wxCas) be built?              no

  **** General Libraries and Tools ****
  Should ccache support be enabled?                          no
  Libraries aMule will use to build:
                                       wxWidgets             2.8.7 (gtk2,shared)
                                       crypto++              5.5.2 (installed, in /usr)
                                       libintl               system
                                       zlib                  1.2.3.3


WARNING! UPnP code has been disabled because libupnp >= 1.6.6 not found (version 1.4.3 is not new enough).

I'm assuming the UPnP code is for router firewall interaction?  I dunno, but I generally eschew UPnP and set the correct ports open manually, so I figured this shouldn't be a problem.  I ran amule in gdb as requested, and here's what I got:

Initial error:
Code: [Select]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f871427c780 (LWP 3130)]
0x0000000000466e1d in CUpDownClient::ClearDownloadBlockRequests (
    this=0x2600660) at BaseClient.cpp:1175
1175 Requested_Block_Struct* cur_block = *it;

Backtrace:
Code: [Select]
(gdb) bt
#0  0x0000000000466e1d in CUpDownClient::ClearDownloadBlockRequests (
    this=0x2600660) at BaseClient.cpp:1175
#1  0x0000000000467427 in CUpDownClient::Disconnected (this=0x2600660,
    strReason=@0x7fff1c2afe40, bFromSocket=false) at BaseClient.cpp:1242
#2  0x000000000047a415 in CClientList::ProcessDirectCallbackList (
    this=0xf2bfd0) at ClientList.cpp:1113
#3  0x000000000047dfd7 in CClientList::Process (this=0xf2bfd0)
    at ClientList.cpp:748
#4  0x0000000000456e87 in CamuleApp::OnCoreTimer (this=0xe4ae10)
    at amule.cpp:1460
#5  0x00007f87124cc72d in wxEvtHandler::ProcessEventIfMatches ()
   from /usr/lib/libwx_baseu-2.8.so.0
#6  0x00007f87124cc8ec in wxEventHashTable::HandleEvent ()
   from /usr/lib/libwx_baseu-2.8.so.0
#7  0x00007f87124cca2d in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.8.so.0
#8  0x00007f87124ccefc in wxEvtHandler::ProcessPendingEvents ()
   from /usr/lib/libwx_baseu-2.8.so.0
#9  0x00007f8712434a1e in wxAppConsole::ProcessPendingEvents ()
   from /usr/lib/libwx_baseu-2.8.so.0
#10 0x00007f8712be55e6 in wxAppBase::ProcessIdle ()
   from /usr/lib/libwx_gtk2u_core-2.8.so.0
#11 0x00007f8712b3c064 in ?? () from /usr/lib/libwx_gtk2u_core-2.8.so.0
#12 0x00007f870fd153d4 in g_main_context_dispatch ()
   from /usr/lib/libglib-2.0.so.0
#13 0x00007f870fd186e5 in ?? () from /usr/lib/libglib-2.0.so.0
#14 0x00007f870fd18a05 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#15 0x00007f8711250f03 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#16 0x00007f8712b5301d in wxEventLoop::Run ()
   from /usr/lib/libwx_gtk2u_core-2.8.so.0
#17 0x00007f8712be558b in wxAppBase::MainLoop ()
   from /usr/lib/libwx_gtk2u_core-2.8.so.0
#18 0x00007f871246b19c in wxEntry () from /usr/lib/libwx_baseu-2.8.so.0
#19 0x000000000061ee90 in main (argc=1, argv=0x7fff1c2b0708)
    at amule-gui.cpp:95

Full backtrace:
Code: [Select]
(gdb) bt full
#0  0x0000000000466e1d in CUpDownClient::ClearDownloadBlockRequests (
    this=0x2600660) at BaseClient.cpp:1175
cur_block = (Requested_Block_Struct *) 0x20047b9b2
it = {<__gnu_debug::_Safe_iterator_base> = {_M_sequence = 0x26008f8,
    _M_version = 0, _M_prior = 0x0, _M_next = 0x0}, _M_current = {
    _M_node = 0x400}}
#1  0x0000000000467427 in CUpDownClient::Disconnected (this=0x2600660,
    strReason=@0x7fff1c2afe40, bFromSocket=false) at BaseClient.cpp:1242
bDelete = false
#2  0x000000000047a415 in CClientList::ProcessDirectCallbackList (
    this=0xf2bfd0) at ClientList.cpp:1113
it2 = {<__gnu_debug::_Safe_iterator_base> = {_M_sequence = 0xf2c290,
    _M_version = 0, _M_prior = 0x0, _M_next = 0x7fff1c2afe10}, _M_current = {
    _M_node = 0x2010a90}}
curClient = (CUpDownClient *) 0x2600660
it = {<__gnu_debug::_Safe_iterator_base> = {_M_sequence = 0xf2c290,
    _M_version = 1, _M_prior = 0x7fff1c2afdb0, _M_next = 0x0}, _M_current = {
    _M_node = 0xf2c280}}
cur_tick = 292131626
#3  0x000000000047dfd7 in CClientList::Process (this=0xf2bfd0)
    at ClientList.cpp:748
cur_tick = 292131626
buddy = Disconnected
current_it = {<__gnu_debug::_Safe_iterator_base> = {
    _M_sequence = 0xf2c230, _M_version = 1, _M_prior = 0x0, _M_next = 0x0},
  _M_current = {_M_node = 0xf2c208}}
#4  0x0000000000456e87 in CamuleApp::OnCoreTimer (this=0xe4ae10)
    at amule.cpp:1460
msCur = 1034576
msPrev1 = 1034576
msPrev5 = 1032375
msPrevSave = 1021379
msPrevHist = 1034000
msPrevOS = 1031079
msPrevKnownMet = 0
#5  0x00007f87124cc72d in wxEvtHandler::ProcessEventIfMatches ()
   from /usr/lib/libwx_baseu-2.8.so.0
No symbol table info available.
#6  0x00007f87124cc8ec in wxEventHashTable::HandleEvent ()
   from /usr/lib/libwx_baseu-2.8.so.0
No symbol table info available.
#7  0x00007f87124cca2d in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.8.so.0
---Type <return> to continue, or q <return> to quit---
No symbol table info available.
#8  0x00007f87124ccefc in wxEvtHandler::ProcessPendingEvents ()
   from /usr/lib/libwx_baseu-2.8.so.0
No symbol table info available.
#9  0x00007f8712434a1e in wxAppConsole::ProcessPendingEvents ()
   from /usr/lib/libwx_baseu-2.8.so.0
No symbol table info available.
#10 0x00007f8712be55e6 in wxAppBase::ProcessIdle ()
   from /usr/lib/libwx_gtk2u_core-2.8.so.0
No symbol table info available.
#11 0x00007f8712b3c064 in ?? () from /usr/lib/libwx_gtk2u_core-2.8.so.0
No symbol table info available.
#12 0x00007f870fd153d4 in g_main_context_dispatch ()
   from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#13 0x00007f870fd186e5 in ?? () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#14 0x00007f870fd18a05 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#15 0x00007f8711250f03 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
No symbol table info available.
#16 0x00007f8712b5301d in wxEventLoop::Run ()
   from /usr/lib/libwx_gtk2u_core-2.8.so.0
No symbol table info available.
#17 0x00007f8712be558b in wxAppBase::MainLoop ()
   from /usr/lib/libwx_gtk2u_core-2.8.so.0
No symbol table info available.
#18 0x00007f871246b19c in wxEntry () from /usr/lib/libwx_baseu-2.8.so.0
No symbol table info available.
#19 0x000000000061ee90 in main (argc=1, argv=0x7fff1c2b0708)
    at amule-gui.cpp:95
No locals.

Backtrace with threading info:
Code: [Select]
(gdb) thread apply all bt

Thread 4 (Thread 0x42762950 (LWP 3145)):
#0  0x00007f8713e83e1d in pthread_cond_timedwait@@GLIBC_2.3.2 ()
   from /lib/libpthread.so.0
#1  0x00007f87124ca0d9 in wxConditionInternal::WaitTimeout ()
   from /usr/lib/libwx_baseu-2.8.so.0
#2  0x00007f87124ca9ae in wxSemaphoreInternal::WaitTimeout ()
   from /usr/lib/libwx_baseu-2.8.so.0
#3  0x000000000073ae56 in CTimerThread::Entry (this=0xe95930) at Timer.cpp:64
#4  0x00007f87124cb23a in wxThreadInternal::PthreadStart ()
   from /usr/lib/libwx_baseu-2.8.so.0
#5  0x00007f8713e7f3f7 in start_thread () from /lib/libpthread.so.0
#6  0x00007f87119b5b3d in clone () from /lib/libc.so.6
#7  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x41760950 (LWP 3143)):
#0  0x00007f8713e86e81 in nanosleep () from /lib/libpthread.so.0
#1  0x00007f87124d062c in wxMicroSleep () from /usr/lib/libwx_baseu-2.8.so.0
#2  0x00000000005a4260 in UploadBandwidthThrottler::Entry (this=0x1ba09e0)
    at UploadBandwidthThrottler.cpp:324
#3  0x00007f87124cb23a in wxThreadInternal::PthreadStart ()
   from /usr/lib/libwx_baseu-2.8.so.0
#4  0x00007f8713e7f3f7 in start_thread () from /lib/libpthread.so.0
#5  0x00007f87119b5b3d in clone () from /lib/libc.so.6
#6  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f871427c780 (LWP 3130)):
#0  0x0000000000466e1d in CUpDownClient::ClearDownloadBlockRequests (
    this=0x2600660) at BaseClient.cpp:1175
#1  0x0000000000467427 in CUpDownClient::Disconnected (this=0x2600660,
    strReason=@0x7fff1c2afe40, bFromSocket=false) at BaseClient.cpp:1242
#2  0x000000000047a415 in CClientList::ProcessDirectCallbackList (
    this=0xf2bfd0) at ClientList.cpp:1113
#3  0x000000000047dfd7 in CClientList::Process (this=0xf2bfd0)
    at ClientList.cpp:748
#4  0x0000000000456e87 in CamuleApp::OnCoreTimer (this=0xe4ae10)
    at amule.cpp:1460
#5  0x00007f87124cc72d in wxEvtHandler::ProcessEventIfMatches ()
   from /usr/lib/libwx_baseu-2.8.so.0
#6  0x00007f87124cc8ec in wxEventHashTable::HandleEvent ()
   from /usr/lib/libwx_baseu-2.8.so.0
#7  0x00007f87124cca2d in wxEvtHandler::ProcessEvent ()
   from /usr/lib/libwx_baseu-2.8.so.0
---Type <return> to continue, or q <return> to quit---
#8  0x00007f87124ccefc in wxEvtHandler::ProcessPendingEvents ()
   from /usr/lib/libwx_baseu-2.8.so.0
#9  0x00007f8712434a1e in wxAppConsole::ProcessPendingEvents ()
   from /usr/lib/libwx_baseu-2.8.so.0
#10 0x00007f8712be55e6 in wxAppBase::ProcessIdle ()
   from /usr/lib/libwx_gtk2u_core-2.8.so.0
#11 0x00007f8712b3c064 in ?? () from /usr/lib/libwx_gtk2u_core-2.8.so.0
#12 0x00007f870fd153d4 in g_main_context_dispatch ()
   from /usr/lib/libglib-2.0.so.0
#13 0x00007f870fd186e5 in ?? () from /usr/lib/libglib-2.0.so.0
#14 0x00007f870fd18a05 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#15 0x00007f8711250f03 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#16 0x00007f8712b5301d in wxEventLoop::Run ()
   from /usr/lib/libwx_gtk2u_core-2.8.so.0
#17 0x00007f8712be558b in wxAppBase::MainLoop ()
   from /usr/lib/libwx_gtk2u_core-2.8.so.0
#18 0x00007f871246b19c in wxEntry () from /usr/lib/libwx_baseu-2.8.so.0
#19 0x000000000061ee90 in main (argc=1, argv=0x7fff1c2b0708)
    at amule-gui.cpp:95
(gdb)

Anway, I hope that helps folks get to the bottom of the problem.  Thanks for a great application, by the way...

P.S. If my searching prowess was insufficient (I did try!), and a solution already exists for this problem, a link would be greatly appreciated!
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: amule 2.2.2 crashing in Ubuntu 8.04 x86_64
« Reply #1 on: October 18, 2008, 10:29:29 PM »

Now that's an exemplary bug report, good job!

Hmm - _M_current = { _M_node = 0x400}
That's the adress where the pointer to the Requested_Block_Struct is supposed to be stored, right? Now, how did the list get corrupted ?  ???

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

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685
Re: amule 2.2.2 crashing in Ubuntu 8.04 x86_64
« Reply #2 on: October 19, 2008, 10:05:53 AM »

stu, I have a better question: How is it possible that just by walking the list we get an invalid iterator (_M_version = 0)? The only possible invalid iterator we should get is end(), but then we wouldn't get to the line trying to dereference it.
Logged
concordia cum veritate

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: amule 2.2.2 crashing in Ubuntu 8.04 x86_64
« Reply #3 on: October 19, 2008, 01:10:17 PM »

Ah, _M_version = 0 is invalid. So we already dereference an invalid iterator it2 at #2 in CClientList::ProcessDirectCallbackList. Again, how's that possible ? Might we be dealing with a defective STL ?
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

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685
Re: amule 2.2.2 crashing in Ubuntu 8.04 x86_64
« Reply #4 on: October 19, 2008, 01:46:45 PM »

So we already dereference an invalid iterator it2 at #2 in CClientList::ProcessDirectCallbackList.
No, we don't.

Code: (ClientList.cpp) [Select]
void CClientList::ProcessDirectCallbackList()
{
// we do check if any direct callbacks have timed out by now
const uint32_t cur_tick = ::GetTickCount();
for (DirectCallbackList::iterator it = m_currentDirectCallbacks.begin(); it != m_currentDirectCallbacks.end();) {
DirectCallbackList::iterator it2 = it++;
CUpDownClient* curClient = *it2;
if (curClient->GetDirectCallbackTimeout() < cur_tick) {
wxASSERT(curClient->GetDirectCallbackTimeout() != 0);
// TODO LOGREMOVE
//DebugLog(_T("DirectCallback timed out (%s)"), pCurClient->DbgGetClientInfo());
m_currentDirectCallbacks.erase(it2);
if (curClient->Disconnected(wxT("Direct Callback Timeout"))) {
curClient->Safe_Delete();
}
}
}
}
looking at the code reveals that by the time of calling curClient->Disconnected() it2 has been already invalidated by the erase() function. That's perfectly normal, because the list holds only pointers, and the pointed-to objects are not destroyed by erase().
« Last Edit: October 19, 2008, 01:49:24 PM by GonoszTopi »
Logged
concordia cum veritate