4-day bug chase

Published April 03, 2007
Advertisement
Wow I don't think I've ever spent so much time chasing down a crash bug. Random crash bugs that occur only in online play can never be fun to fix...

It turned out that some of the territory-sync code I've recently written in the last week or two created packets that collided with the SyncRandomNumber functionality of the RakNet networking library which I use in the game.

It should be noted that I'm using a old version of RakNet, while the lib is currently on v3.0 There were far too many changes for me to consider moving all my functionality over to 3.0 though the irony is that it might have been easier/faster in this case...

Anyways, inside the RakClient::Receive() function there are some special cases for handling client related functionality. One such special case is a SyncRandomNumber packet, this is a special packet sent every ~9 seconds to allow clients to have nearly perfectly synced random numbers over the network.

It turns out that some of my [empty] territory packets [first byte == 23, size == 14 bytes] were being confused as random number packets, and much crashery ensued. When the packet would come out of the Client::Receive() function it's packet identifier was out of the range of my valid packets. Also the data pointer in the packet was no longer valid, so calling the DeallocatePacket() function caused a heap corruption.

Yea 4 days right there...though it seems so simple/easy in hindsight.

I sent my findings to the creator of RakNet, and it turns out this is was a known bug. Anyways I'm very glad that I finally got that sorted out. Now I can get back to working on the actual game...

Also I'm working on the next illegal business, the illegal casino. It looks like it will be the coolest illegal business so far but it's too early to tell [grin].

- Danny

[As a side note...my journal is so fux0red becase of all those un-thumbnailed 1280x1024 screenshots below [grin]]
0 likes 2 comments

Comments

Iced_Eagle
Like they say, hindsight is 20/20.

Oh and yea there's some major stretchage going on in your journal with the text :P Side-scrolling, blah!
April 03, 2007 08:21 PM
Gaheris
Not to mention the loading time for people who cannot enjoy the insane speed of my interweb connection. :D
April 04, 2007 08:57 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement