Game Development Community

How would I debug this?

by Peter Simard · in Torque Game Engine · 10/01/2006 (9:46 am) · 7 replies

Hello everyone. I am in need of some expert advice. I am working on our zoning system and have run into a crash bug that I am unable to pin down.

It usually occurs on the 2nd or 3rd time loading a zone. It will crash during the Loading Datablocks phase. I believe this is because there is an object that is being deleted without the unregisterObject() method being called. Problem is I've searched through my code and have been unable to find it!

It always seems to be a datablock's ID that it crashes on. The datablock seems to be random as it is different ID and class every time. I am really stumped here and would greatly appreciate any assistance in squashing this.

img522.imageshack.us/img522/783/callstackod3.png

#1
10/01/2006 (10:18 am)
Have you tried doing any network testing with the #define TORQUE_DEBUG_NET
set in torqueConfig.h?
#2
10/01/2006 (12:39 pm)
Thanks for the reply Drew.

I enabled the network debugger but unfortunatly it crashes in the exact same place. Any other ideas?
#3
10/01/2006 (12:59 pm)
I think what Drew was asking is did you check to see if the what is being sent on the network is what is being recieved? I would look close at your un/packupdate and writepacketdata/readpacketdata. It might be that the sent/recieved data does not line up so you get funky ids being sent.

Drew, is that what you were thinking?
#4
10/01/2006 (1:02 pm)
Are you using an id already in use?
what does the log say? (assuming you are using it)
#5
10/01/2006 (1:07 pm)
@Frank - There was a mismatched packupdate/unpackupdate in the Questlog class. After fixing it I got no more errors from the network debug but it didn't fix the issue.

@David - The log doesn't reveal anything of value for this.


I don't think the issue is in the networking. The game loads fine, and can even reload once fine. The third time around though it crashes with that error. I'm pretty sure somewhere along the line an object is being deleted without being unregistered but I can't find where.
#6
10/01/2006 (8:05 pm)
You can add log messages to all object constructors and destructors, as well as all places you call register and unregister on the objects. Then, after the crash, walk through this list, matching up the create/destroy pairs (a script would make this easier :-). If the bug is what you think it is, you will find it that way.
#7
10/02/2006 (2:52 pm)
FIXED!

I decided to take hplus's advice in adding checks to the destructors... so I went into the simObject destructor and guess whats there?

AssertFatal(mFlags.test(Added) == 0, "SimObject::object "
               "missing call to SimObject::onRemove");

So there is code already in there, but its not working. interesting.

It turns out I had a preprocessor directive of "DEBUG" not "TORQUE_DEBUG". I set it to the proper one and recompiled. One of my very old resources (we're talking a couple years) was missing the call to Parent::onRemove() in its onRemove(). I added it back in there and all is right!

Thanks to all for the assistance, now I can move onto more fun things like guilds and guild wars!