aMule Forum
English => aMule crashes => Topic started by: Stu Redman on March 23, 2008, 01:39:31 PM
-
Hi folks,
just compiled yesterday's SVN with MingW (compiled fine). But it doesn't run under Vista SP1. After 20s or so amule simply crashes (Windows pops up "problem in application"), and there is no backtrace. Same with an older snapshot (January). :(
I compiled wxMSW-2.8.7 as static as described in the wiki. I remember similiar problems under Linux 3 months ago, then I solved it by compiling wx as dynamic.
Could anybody please post a set of working configure options for wx and amule under Windows ?
Does backtracing work at all under Windows ?
-
You can install gdb in mingw.
-
Ah, I see.
Looks like a problem with the addr passed to the function. ip is 0 and it crashes on trying to determine the port.
(gdb) bt
#0 0x00000000 in ?? ()
#1 0x0044417b in CClientUDPSocket::OnPacketReceived (this=0x85f39b0,
addr=@0x22f97c,
buffer=0x22b97c "ä(\223#Ö\v4m\206nâ_Wè\225\005aÃ\v\023c~\véU·Z\036i¼ûÙÐ\nú\224\f", length=294) at ClientUDPSocket.cpp:82
#2 0x0048c639 in CMuleUDPSocket::OnReceive (this=0x85f39b0, errorCode=0)
at MuleUDPSocket.cpp:178
#3 0x00444062 in CClientUDPSocket::OnReceive (this=0x85f39b0, errorCode=0)
at ClientUDPSocket.cpp:66
#4 0x00410bea in CamuleApp::UDPSocketHandler (this=0x8515a90,
event=@0x85f3570) at amule.cpp:2119
#5 0x008c6f65 in wxEvtHandler::ProcessEventIfMatches ()
at c:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/iostream:77
#6 0x008c72bc in wxEventHashTable::HandleEvent ()
at c:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/iostream:77
#7 0x008c82b9 in wxEvtHandler::ProcessEvent ()
at c:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/iostream:77
#8 0x008c80d9 in wxEvtHandler::ProcessPendingEvents ()
at c:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/iostream:77
#9 0x008c6274 in wxAppConsole::ProcessPendingEvents ()
at c:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/iostream:77
#10 0x00acb315 in wxIdleWakeUpModule::MsgHookProc ()
at c:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/iostream:77
#11 0x76ef8cff in USER32!CallNextHookEx () from C:\Windows\system32\user32.dll
#12 0x00000000 in ?? ()
(gdb) bt full 4
#0 0x00000000 in ?? ()
No symbol table info available.
#1 0x0044417b in CClientUDPSocket::OnPacketReceived (this=0x85f39b0,
addr=@0x22f97c,
buffer=0x22b97c "ä(\223#Ö\v4m\206nâ_Wè\225\005aÃ\v\023c~\véU·Z\036i¼ûÙÐ\nú\224\f", length=294) at ClientUDPSocket.cpp:82
protocol = 228 'ä'
opcode = 40 '('
ip = 0
port = 30519
#2 0x0048c639 in CMuleUDPSocket::OnReceive (this=0x85f39b0, errorCode=0)
at MuleUDPSocket.cpp:178
buffer = "ä(\223#Ö\v4m\206nâ_Wè\225\005aÃ\v\023c~\véU·Z\036i¼ûÙÐ\nú\224\f\000Wt)\224ã\002\214ù\000\n\232¡sÁH\200ã³ÌÛC\035i¢E½¥}\003s\002ÑYB\t%ʵnNë\034L\0051\b»¤:\005Q\aða4\002,¦O\t¯e\034Á¼XôbM\v{çuÄ;DÈ@<¿\002\200QL\t1Ø\236r7«ôý\235PzA÷µ¥vq\224ÐB\002 \224H\t¶F\2101\n¸\002¼¨3\016§«¤NÛ\214s?\236\002MlÜ\017~\224\230ùÆù \233µ-\t¶oEþÕ\213d5p\002©tÛ\017¦\237"...
addr = <incomplete type>
length = 294
error = false
lastError = 0
#3 0x00444062 in CClientUDPSocket::OnReceive (this=0x85f39b0, errorCode=0)
at ClientUDPSocket.cpp:66
No locals.
(More stack frames follow...)
(gdb)
void CClientUDPSocket::OnPacketReceived(const wxIPV4address& addr, byte* buffer, size_t length)
{
wxCHECK_RET(length >= 2, wxT("Invalid packet."));
uint8 protocol = buffer[0];
uint8 opcode = buffer[1];
uint32 ip = StringIPtoUint32(addr.IPAddress());
uint16 port = addr.Service();
void CMuleUDPSocket::OnReceive(int errorCode)
{
...
length = m_socket->RecvFrom(addr, buffer, UDP_BUFFER_SIZE).LastCount();
error = m_socket->Error();
lastError = m_socket->LastError();
}
if (error) {
OnReceiveError(lastError, addr);
} else if (length < 2) {
...
} else {
AddDebugLogLineM(false, logMuleUDP, (m_name + wxT(": Packet received ("))
<< addr.IPAddress() << wxT(":") << addr.Service() << wxT("): ")
<< length << wxT("b"));
OnPacketReceived(addr, (byte*)buffer, length);
}
}
A quick & dirty
void CClientUDPSocket::OnPacketReceived(const wxIPV4address& addr, byte* buffer, size_t length)
{
wxCHECK_RET(length >= 2, wxT("Invalid packet."));
uint8 protocol = buffer[0];
uint8 opcode = buffer[1];
uint32 ip = StringIPtoUint32(addr.IPAddress());
if (ip == 0) return; // WORKAROUND VISTA CRASH
uint16 port = addr.Service();
seems to fix it, it hasn't crashed since.
-
Interesting. On my system, calling Service() in CMuleUDPSocket::OnReceive worked fine (for instance while logging), but calling it in CClientUDPSocket::OnPacketReceived always crashed. So as a workaround, I changed the function-signature to take ip/port instead of a IPV4 object.
However, the change you've made should actually not make a difference, since we already check if the ip is invalid in OnReceive. =/
-
Doesn't compile. ;)
2 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32 amulerc.o -lz
amule-ClientUDPSocket.o: In function `ZN20wxThreadHelperThread5EntryEv':
C:/MinGW/home/Martin/amulesvn/src/ClientUDPSocket.cpp:(.rdata$_ZTV16CClientUDPSocket[vtable for CClientUDPSocket]+0x1c): undefined reference to `CMuleUDPSocket::OnReceiveError(int, wxIPV4address const&)'
collect2: ld returned 1 exit status
make: *** [amule.exe] Error 1
-
You mean current SVN?
Try to make clean, as there are no calls to that function signature any more.
-
You're right of course. I screwed up with the update obviously. :-[
Now it's running fine. Thank you!