aMule Forum

English => Backtraces => Topic started by: phoenix on October 23, 2010, 11:36:03 PM

Title: Packet.cpp(275): assert "prot == OP_PACKEDPROT" failed in UnPackPacket().
Post by: phoenix on October 23, 2010, 11:36:03 PM
Code: [Select]
ASSERT INFO:
Packet.cpp(275): assert "prot == OP_PACKEDPROT" failed in UnPackPacket().

BACKTRACE:
[1] wxOnAssert(wchar_t const*, int, char const*, wchar_t const*, wchar_t const*)
[2] CPacket::UnPackPacket(unsigned int) /home/asdf/trunk5/src/Packet.cpp:277
[3] CClientTCPSocket::PacketReceived(CPacket*) /home/asdf/trunk5/src/ClientTCPSocket.cpp:2040
[4] CEMSocket::OnReceive(int) /home/asdf/trunk5/src/EMSocket.cpp:284
[5] CClientTCPSocket::OnReceive(int) /home/asdf/trunk5/src/ClientTCPSocket.cpp:1966
[6] CClientTCPSocketHandler::ClientTCPSocketHandler(wxSocketEvent&) /home/asdf/trunk5/src/ClientTCPSocket.cpp:101
[7] wxAppConsole::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) cons)
[8] wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&)
[9] wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)
[10] wxEvtHandler::ProcessEvent(wxEvent&)
[11] wxEvtHandler::ProcessPendingEvents()
[12] wxAppConsole::ProcessPendingEvents()
[13] wxAppBase::ProcessIdle()
[14] g_main_context_dispatch()
[15] g_main_loop_run()
[16] gtk_main()
[17] wxEventLoop::Run()
[18] wxAppBase::MainLoop()

The problem is that in src/Packet.cpp we "wxASSERT( prot == OP_PACKEDPROT );", but in src/ClientTCPSocket.cpp:2037 we have:

Code: [Select]
if ((packet->GetProtocol() == OP_PACKEDPROT) ||
(packet->GetProtocol() == OP_ED2KV2PACKEDPROT)) {

Most likely the assertion is wrong, but I leave that to you folks, the protocol issues are not fresh in my mind... Anyway the suggested patch follows, feel free to commit or not, the decision is yours.

Cheers!
Title: Re: Packet.cpp(275): assert "prot == OP_PACKEDPROT" failed in UnPackPacket().
Post by: Kry on October 25, 2010, 10:40:29 PM
We don't even send OP_ED2KV2PACKEDPROT, ever, and we're the only ones that create that (because it's my test code, and it's not enabled).

More likely than not your packet had a wrong protocol number, either coming from another client or just a wrong packet. We should probably log instead of assert in this case.

BUT

You're right, that assert had to be updated anyway to reflect OP_ED2KV2PACKEDPROT.
Title: Re: Packet.cpp(275): assert "prot == OP_PACKEDPROT" failed in UnPackPacket().
Post by: phoenix on October 27, 2010, 01:52:18 PM
Weird. Maybe someone else is playing with protocol.

Anyway, I have committed a version that logs it.

Cheers!