Log in

View Full Version : Crash on EntityList::AIYellForHelp?


Secrets
04-24-2009, 10:29 PM
I'm seeing a lot of this in core dumps. Whenever this function is called, it occasionally puts this out with this:

0x081d080a in EntityList::AIYellForHelp (this=0x8373ec0, sender=0x8bf3738, attacker=0x8c265b0) at aggro.cpp:437

And when I go to line 437, it's a bunch of conditionals:

if (
mob != sender
&& mob != attacker
// && !mob->IsCorpse()
// && mob->IsAIControlled()
&& mob->GetPrimaryFaction() != 0
&& mob->DistNoRoot(*sender) <= r
&& !mob->IsEngaged()
)

which I assume is being met, due to this being filled in as well as attacker & sender, but since it is generating a core dump I can only assume not.

Anyone have an idea on how to fix this?

Derision
04-25-2009, 03:59 AM
Is this crash occurrng with the current stock source ?

It would appear that none of the pointers can be NULL at that point, so the only reason for a crash would be a pointer to a mob instance that has been destroyed and not been removed from the entity list.

I made some fixes a while ago, so that shouldn't be able to happen. Without knowing how to reproduce it, it will difficult to track down.

Secrets
04-25-2009, 04:56 AM
Is this crash occurrng with the current stock source ?

It would appear that none of the pointers can be NULL at that point, so the only reason for a crash would be a pointer to a mob instance that has been destroyed and not been removed from the entity list.

I made some fixes a while ago, so that shouldn't be able to happen. Without knowing how to reproduce it, it will difficult to track down.

Yes, this is in current stock source, with minor edits, to none of which were aggro.cpp.. Unfortunately, i've never witnessed it go down, i've just seen core dumps of it. :/

I'll look into the entity list and see if anything is screwed up there. I might have missed something when I merged in SVN, but I doubt it.

Secrets
04-25-2009, 05:02 AM
Ok, looked in source, didn't see any of the changes related to the entity list that I made nor aggro.cpp or hate_list.cpp. Kind of lost still. :/

Derision
04-25-2009, 05:47 AM
The fixes I made that were meant to stop that where in the mob destructor:

mob.cpp

Mob::~Mob()
{
// Our Entity ID is set to 0 in NPC::Death. This leads to mobs hanging around for a while in
// the entity list, even after they have been destroyed. Use our memory pointer to remove the mob
// if our EntityID is 0.
//

if(GetID() > 0)
entity_list.RemoveMob(GetID());
else
entity_list.RemoveMob(this);



and the end of the client destructor:

client.cpp

Client::~Client() {
<snip>
entity_list.RemoveClient(this);
}

void Client::SendLogoutPackets() {


If you have the code in green, I am not sure what could be causing the problem.

Secrets
04-25-2009, 02:12 PM
I have both of the code in green. I'm not sure what could be causing it, still. Is there any way to use gdb to figure out the issue otherwise?

KLS
04-25-2009, 02:34 PM
I've seen a few core dumps from PEQ in the past that have this. The stack trace was really odd too, I couldn't figure out where it was crashing at all.