aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: 2.2.3 Windows XP - crash on global search  (Read 6957 times)

piulus

  • Newbie
  • Karma: 0
  • Offline Offline
  • Posts: 2
2.2.3 Windows XP - crash on global search
« on: January 17, 2009, 11:11:51 AM »

Hello,
aMule version: 2.2.3 windows (official binary release from amule.org)
Windows versions tested: Windows XP X64 professional service pack 2 with italian language pack
                                                 Windows XP professional X86 service pack 3 italian
To reproduce:
- start aMule (obviously :-)
- connect to ed2k and kad
- go to search tab
- insert a search string and select "Global" search type
- try to select a result
- CRASH!

Note: sometimes it crashes  even without click on a result, I tried several combination of various types of search (kad, local, global) but it invariably crashes on global searches. aMule 2.2.2 does not have this behaviour.

Had someone else got this crashes?
Bye
Paolo
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: 2.2.3 Windows XP - crash on global search
« Reply #1 on: January 17, 2009, 05:28:24 PM »

I can only reproduce it like this:
- turn off ed2k
- restart aMule
- turn on ed2k
...
Problem is the server udp port which is not opened anymore in Kad only mode.
I've added a restart warning if ED2K was enabled.
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

piulus

  • Newbie
  • Karma: 0
  • Offline Offline
  • Posts: 2
Re: 2.2.3 Windows XP - crash on global search
« Reply #2 on: January 18, 2009, 03:01:26 PM »

I can only reproduce it like this:
- turn off ed2k
- restart aMule
- turn on ed2k

I tried that, but to me it doesn't crash.
To me it crash only when I perform a global search (not local nor kad): it shows me the results, but then it crash when I try to select a result line.
Since this happens on two different machines with two different processors _and_ architectures (AMD Athlon 64 bit with XP X64 and Intel 32 bit with XP X86) I suppose there could be a bug in the 2.2.3 global search code.
But I'm not an aMule hacker (I'm not a hacker at all!  :-) so your guess could be correct.
Bye
Paolo
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: 2.2.3 Windows XP - crash on global search
« Reply #3 on: January 18, 2009, 04:46:56 PM »

You overlooked the "..." which was supposed to mean "then do the steps from piulus' post".

Please try:

- enable ED2k
- restart aMule
- do a global search

Still crashing?
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

mr_hyde

  • Global Moderator
  • Full Member
  • *****
  • Karma: 12
  • Offline Offline
  • Posts: 105
Re: 2.2.3 Windows XP - crash on global search
« Reply #4 on: January 24, 2009, 05:20:07 PM »

I have a similar (same?) problem.

I used MSVC 2008 Express Edition to build aMule, wxWdigets 2.8.9.

I use Windows XP service pack 3.

To reproduce the problem I:
1) started aMule (in Preferences both ed2k and kad are enebled)
2) go to searches tab
3) selected global as type of search
4) typed "linux" in field "Name:" and pressed the "Start" button

at this point I can see the area of the window populated by the resalts (just for some seconds) then aMule crashes.

This did not happen with other terms of research (may be that the error is related to the number of results found?).

I tried to use MSVC debug but I was only able to find the following list of call (Windows is not my native environment ;-) ):

wxThread::IsDetached
this is a simple inline method:
Code: [Select]
bool IsDetached() const { return m_isDetached; }

called by wxThreadInternal::LetDie

called by wxThreadKeepAlive::~wxThreadKeepAlive  (destructor)

called by wxThreadInternal::WaitForTerminate

called by wxThread::Wait

called by CMuleThread::Stop  (at the end a aMule  method!)

Bye,
  Mr Hyde
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: 2.2.3 Windows XP - crash on global search
« Reply #5 on: January 24, 2009, 07:00:28 PM »

Could reproduce it. It looks like something is screwed with wxTread on MSW. I'm looking into 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

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: 2.2.3 Windows XP - crash on global search
« Reply #6 on: January 25, 2009, 12:21:55 AM »

Please try this patch, it does the trick for me.

Code: [Select]
Index: src/SearchList.cpp
===================================================================
--- src/SearchList.cpp (revision 9393)
+++ src/SearchList.cpp (working copy)
@@ -611,13 +611,13 @@
 
 void CSearchList::StopGlobalSearch()
 {
- m_searchTimer.Stop();
-
  m_currentSearch = -1;
  delete m_searchPacket;
  m_searchPacket = NULL;
  m_searchInProgress = false;
 
+ m_searchTimer.Stop();
+
  CoreNotify_Search_Update_Progress(0xffff);
 }
 
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

mr_hyde

  • Global Moderator
  • Full Member
  • *****
  • Karma: 12
  • Offline Offline
  • Posts: 105
Re: 2.2.3 Windows XP - crash on global search
« Reply #7 on: January 25, 2009, 11:35:14 AM »

Tested your patch in:
- Windows XP, Service Pack 3, wxWidgets 2.8.9
- Slackware Linux 32 bit, wxWidgets 2.8.9

It worked in both environments.

Thanks a lot,
  Mr Hyde
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: 2.2.3 Windows XP - crash on global search
« Reply #8 on: January 25, 2009, 03:01:08 PM »

Well, there's definitely something strange going on im wxMSW here.  ???
Problem is the stopping of the search timer in CSearchList::StopGlobalSearch():

Code: [Select]
inline void CMuleThread::Stop()
{
m_stop = true;
try{
if (IsDetached()) {
Delete();
} else {
Wait();
}
} catch(...) {
m_stop = true;
}
m_stop = true;
}

I have set breakpoints on each m_stop = true and added a try/catch for good measure. Still what happens is:
- break on first line
- single-step up to the Wait()
- again break on the first line!
Stepping through the whole thing reveals that at some point GetMessage() for the main thread is called (see stack trace) which gets the next timer event, going into CSearchList::OnGlobalSearchTimer() and thus CSearchList::StopGlobalSearch() again. So the thread is deleted multiply which leads to the crash.

The patch simply deletes the packet first so that OnGlobalSearchTimer() returns immediately without calling StopGlobalSearch() again. Duh.
I'd file a wx bug if I knew how to break this down to a simpler example than whole aMule...
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: 2.2.3 Windows XP - crash on global search
« Reply #9 on: January 26, 2009, 01:34:11 AM »

Eh, Wait() on a thread flushes the events on windows. It has bitten me in the behind before, but it is actually the way it works.

And you know why it's fucked up in aMule, Stu?

Quote from: wxWidgets Docs
This function can only be called from another thread context.
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: 2.2.3 Windows XP - crash on global search
« Reply #10 on: January 27, 2009, 12:07:27 AM »

Eh, Wait() on a thread flushes the events on windows. It has bitten me in the behind before, but it is actually the way it works.
That explains it.

And you know why it's fucked up in aMule, Stu?

Quote from: wxWidgets Docs
This function can only be called from another thread context.
Wait() on the timer thread is called from the main thread, so what's wrong? Or doesn't the main thread count as "another thread context"?
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