Jump to content
  • Advertisement
  • entries
    338
  • comments
    2045
  • views
    1163648

4-day bug chase

Sign in to follow this  

193 views

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]]
Sign in to follow this  


2 Comments


Recommended Comments

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!

Share this comment


Link to comment
Not to mention the loading time for people who cannot enjoy the insane speed of my interweb connection. :D

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!